public static class FloatLists.Singleton extends AbstractFloatList implements RandomAccess, Serializable, Cloneable
This class may be useful to implement your own in case you subclass a type-specific list.
AbstractFloatList.FloatSubList| Modifier | Constructor and Description |
|---|---|
protected |
Singleton(float element) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAll(Collection<? extends Float> c) |
boolean |
addAll(FloatCollection c)
Adds all elements of the given type-specific collection to this collection.
|
boolean |
addAll(FloatList c)
Appends all of the elements in the specified type-specific list to the end of this type-specific list (optional operation).
|
boolean |
addAll(int i,
Collection<? extends Float> c)
Adds all of the elements in the specified collection to this list (optional operation).
|
boolean |
addAll(int i,
FloatCollection c)
Inserts all of the elements in the specified type-specific collection into this type-specific list at the specified position (optional operation).
|
boolean |
addAll(int i,
FloatList c)
Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).
|
void |
addElements(int index,
float[] a)
Add (hopefully quickly) elements to this type-specific list.
|
void |
addElements(int index,
float[] a,
int offset,
int length)
Add (hopefully quickly) elements to this type-specific list.
|
void |
clear() |
Object |
clone() |
boolean |
contains(float k)
Returns true if this list contains the specified element.
|
float |
getFloat(int i)
Returns the element at the specified position in this list.
|
FloatListIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
FloatListIterator |
listIterator()
Returns a type-specific list iterator on the list.
|
FloatListIterator |
listIterator(int i)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(float k)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
|
boolean |
removeAll(Collection<?> c) |
boolean |
removeAll(FloatCollection c)
Remove from this collection all elements in the given type-specific collection.
|
void |
removeElements(int from,
int to)
Removes (hopefully quickly) elements of this type-specific list.
|
float |
removeFloat(int i)
Removes the element at the specified position in this list (optional operation).
|
boolean |
retainAll(Collection<?> c) |
boolean |
retainAll(FloatCollection c)
Retains in this collection only elements from the given type-specific collection.
|
void |
setElements(float[] a)
Set (hopefully quickly) elements to match the array given.
|
void |
setElements(int index,
float[] a)
Set (hopefully quickly) elements to match the array given.
|
void |
setElements(int index,
float[] a,
int offset,
int length)
Set (hopefully quickly) elements to match the array given.
|
int |
size() |
void |
size(int size)
Sets the size of this list.
|
void |
sort(Comparator<? super Float> comparator)
Deprecated.
|
void |
sort(FloatComparator comparator)
Sort a list using a type-specific comparator.
|
FloatList |
subList(int from,
int to)
Returns a type-specific view of the portion of this list from the index
from, inclusive, to the index to, exclusive. |
float[] |
toFloatArray()
Returns a primitive type array containing the items of this collection.
|
void |
unstableSort(Comparator<? super Float> comparator)
Deprecated.
|
void |
unstableSort(FloatComparator comparator)
Sorts this list using a sort not assured to be stable.
|
add, add, compareTo, ensureIndex, ensureRestrictedIndex, equals, getElements, hashCode, indexOf, lastIndexOf, peekFloat, popFloat, push, set, topFloat, toStringadd, contains, containsAll, remove, toArray, toFloatArraycontainsAll, isEmpty, toArray, toArrayfinalize, getClass, notify, notifyAll, wait, wait, waitadd, add, contains, get, indexOf, lastIndexOf, remove, remove, setcontainsAll, isEmpty, replaceAll, spliterator, toArray, toArraycontainsAll, removeIf, removeIf, toArray, toFloatArrayparallelStream, streamforEach, forEachpeek, pop, push, toppublic float getFloat(int i)
FloatListgetFloat in interface FloatListList.get(int)public boolean rem(float k)
AbstractFloatListThis implementation delegates to indexOf().
rem in interface FloatCollectionrem in class AbstractFloatListList.remove(Object)public float removeFloat(int i)
AbstractFloatListThis implementation always throws an UnsupportedOperationException.
removeFloat in interface FloatListremoveFloat in class AbstractFloatListList.remove(int)public boolean contains(float k)
AbstractFloatListThis implementation delegates to indexOf().
contains in interface FloatCollectioncontains in class AbstractFloatListList.contains(Object)public float[] toFloatArray()
FloatCollectiontoFloatArray in interface FloatCollectiontoFloatArray in class AbstractFloatCollectionCollection.toArray()public FloatListIterator listIterator()
AbstractFloatListThis implementation delegates to listIterator(0).
listIterator in interface FloatListlistIterator in interface List<Float>listIterator in class AbstractFloatListList.listIterator()public FloatListIterator iterator()
AbstractFloatListNote that this specification strengthens the one given in
Iterable.iterator(), which was already
strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Collection.
This implementation delegates to AbstractFloatList.listIterator().
iterator in interface FloatCollectioniterator in interface FloatIterableiterator in interface FloatListiterator in interface Iterable<Float>iterator in interface Collection<Float>iterator in interface List<Float>iterator in class AbstractFloatListIterable.iterator()public FloatListIterator listIterator(int i)
AbstractFloatListThis implementation is based on the random-access methods.
listIterator in interface FloatListlistIterator in interface List<Float>listIterator in class AbstractFloatListList.listIterator(int)public FloatList subList(int from, int to)
FloatListfrom, inclusive, to the index to, exclusive.
Note that this specification strengthens the one given in List.subList(int,int).
subList in interface FloatListsubList in interface List<Float>subList in class AbstractFloatListList.subList(int,int)public boolean addAll(int i,
Collection<? extends Float> c)
AbstractFloatListaddAll in interface List<Float>addAll in class AbstractFloatListpublic boolean addAll(Collection<? extends Float> c)
AbstractFloatListThis implementation delegates to the type-specific version of List.addAll(int, Collection).
addAll in interface Collection<Float>addAll in interface List<Float>addAll in class AbstractFloatListpublic boolean removeAll(Collection<?> c)
removeAll in interface Collection<Float>removeAll in interface List<Float>removeAll in class AbstractCollection<Float>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<Float>retainAll in interface List<Float>retainAll in class AbstractCollection<Float>public boolean addAll(FloatList c)
AbstractFloatListThis implementation delegates to the type-specific list version of List.addAll(int, Collection).
addAll in interface FloatListaddAll in class AbstractFloatListList.add(int,Object)public boolean addAll(int i,
FloatList c)
AbstractFloatListThis implementation delegates to the type-specific version of List.addAll(int, Collection).
addAll in interface FloatListaddAll in class AbstractFloatListList.add(int,Object)public boolean addAll(int i,
FloatCollection c)
FloatListaddAll in interface FloatListaddAll in class AbstractFloatListList.addAll(int,java.util.Collection)public boolean addAll(FloatCollection c)
AbstractFloatListThis implementation delegates to the type-specific version of List.addAll(int, Collection).
addAll in interface FloatCollectionaddAll in class AbstractFloatListc - a type-specific collection.true if this collection changed as a result of the call.Collection.addAll(Collection)public boolean removeAll(FloatCollection c)
FloatCollectionremoveAll in interface FloatCollectionremoveAll in class AbstractFloatCollectionc - a type-specific collection.true if this collection changed as a result of the call.Collection.removeAll(Collection)public boolean retainAll(FloatCollection c)
FloatCollectionretainAll in interface FloatCollectionretainAll in class AbstractFloatCollectionc - a type-specific collection.true if this collection changed as a result of the call.Collection.retainAll(Collection)public void sort(FloatComparator comparator)
FloatListPass null to sort using natural ordering.
sort in interface FloatListList.sort(java.util.Comparator)public void unstableSort(FloatComparator comparator)
FloatListPass null to sort using natural ordering.
This differs from List.sort(java.util.Comparator) in that the results are
not assured to be stable, but may be a bit faster.
Unless a subclass specifies otherwise, the results of the method if the list is concurrently modified during the sort are unspecified.
unstableSort in interface FloatList@Deprecated public void sort(Comparator<? super Float> comparator)
FloatList@Deprecated public void unstableSort(Comparator<? super Float> comparator)
FloatListunstableSort in interface FloatListpublic void removeElements(int from,
int to)
AbstractFloatListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
removeElements in interface FloatListremoveElements in class AbstractFloatListfrom - the start index (inclusive).to - the end index (exclusive).public void addElements(int index,
float[] a)
AbstractFloatListThis implementation delegates to the analogous method for array fragments.
addElements in interface FloatListaddElements in class AbstractFloatListindex - the index at which to add elements.a - the array containing the elements.public void addElements(int index,
float[] a,
int offset,
int length)
AbstractFloatListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements in interface FloatListaddElements in class AbstractFloatListindex - the index at which to add elements.a - the array containing the elements.offset - the offset of the first element to add.length - the number of elements to add.public void setElements(float[] a)
FloatListsetElements in interface FloatLista - the array containing the elements.public void setElements(int index,
float[] a)
FloatListsetElements in interface FloatListindex - the index at which to start setting elements.a - the array containing the elements.public void setElements(int index,
float[] a,
int offset,
int length)
FloatList
ListIterator iter = listIterator(index);
int i = 0;
while (i < length) {
iter.next();
iter.set(a[offset + i++]);
}
However, the exact implementation may be more efficient, taking into account
whether random access is faster or not, or at the discretion of subclasses,
abuse internals.setElements in interface FloatListindex - the index at which to start setting elements.a - the array containing the elementsoffset - the offset of the first element to add.length - the number of elements to add.public int size()
size in interface Collection<Float>size in interface List<Float>size in class AbstractCollection<Float>public void size(int size)
FloatListIf the specified size is smaller than the current size, the last elements are
discarded. Otherwise, they are filled with 0/null/false.
size in interface FloatListsize in class AbstractFloatListsize - the new size.public void clear()
AbstractFloatListThis implementation delegates to AbstractFloatList.removeElements(int, int).
clear in interface Collection<Float>clear in interface List<Float>clear in class AbstractFloatListCopyright © 2020. All rights reserved.