Class FloatObjBigList
java.lang.Object
java.util.AbstractCollection<Float>
java.util.AbstractList<Float>
org.magicwerk.brownies.collections.IList<Float>
org.magicwerk.brownies.collections.primitive.FloatObjBigList
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Float>
,Collection<Float>
,List<Float>
,RandomAccess
,SequencedCollection<Float>
,ICollection<Float>
,IListable<Float>
- Direct Known Subclasses:
FloatObjBigList.ImmutableFloatObjBigList
FloatObjBigList implements the List interface and uses an instance
of FloatBigList for storage. It therefore allows to use the advantages
of primitive collections like saved memory and improved execution
speed when standard list collections are expected.
Note that this implementation is not synchronized.
- Version:
- $Id: FloatObjBigList.java 2200 2014-03-21 10:46:29Z origo $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
An immutable version of a BigList.Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.IList
IList.IListableFromArray<E>, IList.IListableFromCollection<E>, IList.IListableFromList<E>, IList.IListableFromMult<E>
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionFloatObjBigList
(int capacity) FloatObjBigList
(Collection<? extends Float> elems) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addAll
(int index, Collection<? extends Float> coll) Inserts all of the elements in the specified collection into this list, starting at the specified position.boolean
Inserts all of the elements in the specified list into this list, starting at the specified position.boolean
addAll
(Collection<? extends Float> coll) Adds all of the elements in the specified collection into this list.boolean
Adds all of the elements in the specified list into this list.boolean
Inserts the specified elements into this list, starting at the specified position.boolean
Adds all specified elements into this list.<K> int
binarySearch
(int index, int len, K key, Comparator<? super K> comparator) Searches the specified range for an object using the binary search algorithm.int
capacity()
Returns capacity of this BigList.clone()
Returns a shallow copy of this list.boolean
boolean
containsAll
(Collection<?> coll) boolean
containsAny
(Collection<?> coll) Returns true if any of the elements of the specified collection is contained in the list.copy()
Returns a shallow copy of this list.static FloatObjBigList
create()
static FloatObjBigList
static FloatObjBigList
create
(Collection<? extends Float> elems) protected boolean
Helper method for adding an element to the list.protected void
Assign this list the content of the that list.protected void
Initialize this object after the bitwise copy has been made by Object.clone().doCreate
(int capacity) Create list with specified capacity.protected void
doEnsureCapacity
(int minCapacity) Increases the capacity of this list instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.protected Float
doGet
(int index) Helper method for getting an element from the list.protected void
Helper method to fill the specified elements in an array.protected Float
doRemove
(int index) Helper method to remove an element.protected void
doRemoveAll
(int index, int len) Remove specified range of elements from list.protected Float
Sets an element at specified position.protected Float
Helper method for setting an element in the list.boolean
get
(int index) Return element at specified positiongetAll
(int index, int len) Returns specified range of elements from list.int
hashCode()
Returns an immutable copy of this list.int
void
init()
void
void
init
(Collection<? extends Float> elems) boolean
isEmpty()
boolean
Returns true if this list is either unmodifiable or immutable, false otherwise.int
lastIndexOf
(Object elem) void
move
(int srcIndex, int dstIndex, int len) Move specified elements.boolean
boolean
removeAll
(Collection<?> coll) boolean
boolean
removeFirstOccurrence
(Object elem) boolean
removeLastOccurrence
(Object elem) boolean
retainAll
(Collection<?> coll) boolean
void
setAll
(int index, Collection<? extends Float> coll) Sets the specified elements.void
Sets the specified elements.void
Sets the specified elements.int
size()
Return size of listvoid
sort
(int index, int len, Comparator comparator) Sort specified elements in the list using the specified comparator.Object[]
toArray
(int index, int len) Returns an array containing the specified elements in this list.<T> T[]
Returns an array containing the specified elements in this list.<T> T[]
toArray
(T[] array, int index, int len) Returns an array containing the specified elements in this list.(package private) static float[]
toPrimitive
(Float[] elems) (package private) static float[]
toPrimitive
(Collection<? extends Float> list) (package private) static float[]
toPrimitive
(BigList<? extends Float> list2) toString()
(package private) static Float[]
toWrapper
(float[] elems) void
An application can use this operation to minimize the storage of an instance.Returns an unmodifiable view of this list.Methods inherited from class org.magicwerk.brownies.collections.IList
add, add, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, asDeque, asIListable, binarySearch, checkIndex, checkIndexAdd, checkLength, checkLengths, checkNonNull, checkRange, clear, containsIf, copy, count, countIf, crop, descendingIterator, doAddAll, doClear, doCreateArray, doIndexOf, doIndexOfIf, doInitAll, doLastIndexOf, doLastIndexOfIf, doModify, doPutAll, doReplace, doRotate, drag, element, ensureCapacity, extract, extractIf, fill, filter, filterMap, flatMap, getAll, getDistinct, getFirst, getFirstOrNull, getIf, getLast, getLastOrNull, getSingle, getSingleOrNull, indexOf, indexOfIf, indexOfIf, initAll, initAll, initArray, initMult, iterator, lastIndexOf, lastIndexOfIf, lastIndexOfIf, listIterator, listIterator, map, mapFilter, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, remove, removeAll, removeFirst, removeIf, removeLast, replace, replaceAll, replaceAll, replaceArray, replaceMult, resize, retain, retainIf, reverse, reverse, rotate, rotate, set, setArray, setMult, sort, swap, toArray, toArray, toArray, transferCopy, transferMove, transferRemove, transferSwap, transform, transformedList
Methods inherited from class java.util.AbstractList
removeRange, subList
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
replaceAll, reversed, spliterator, subList
-
Field Details
-
list
FloatBigList list
-
-
Constructor Details
-
FloatObjBigList
public FloatObjBigList() -
FloatObjBigList
public FloatObjBigList(int capacity) -
FloatObjBigList
-
-
Method Details
-
toWrapper
-
toPrimitive
-
toPrimitive
-
toPrimitive
-
create
-
create
-
create
-
init
public void init() -
init
-
init
-
doClone
Description copied from class:IList
Initialize this object after the bitwise copy has been made by Object.clone(). -
doAssign
Description copied from class:IList
Assign this list the content of the that list. This is done by bitwise copying so the that list should not be used afterwards. -
isReadOnly
public boolean isReadOnly()Description copied from class:IList
Returns true if this list is either unmodifiable or immutable, false otherwise.- Specified by:
isReadOnly
in classIList<Float>
-
copy
Description copied from class:IList
Returns a shallow copy of this list. The new list will contain the same elements as the source list, i.e. the elements themselves are not copied. The capacity of the list will be set to the number of elements, i.e. size and capacity are equal. This returned list will be modifiable, i.e. a read-only list will be copied and be modifiable again. -
clone
Description copied from class:IList
Returns a shallow copy of this list. The new list will contain the same elements as the source list, i.e. the elements themselves are not copied. The capacity of the list will be set to the number of elements, i.e. size and capacity are equal. If the list is read-only, the same list is returned without change. UseIList.copy()
to . -
getDefaultElem
- Specified by:
getDefaultElem
in classIList<Float>
-
doCreate
Description copied from class:IList
Create list with specified capacity. -
size
public int size()Description copied from interface:IListable
Return size of list -
capacity
public int capacity()Returns capacity of this BigList. Note that two BigLists are considered equal even if they have a distinct capacity. Also the capacity can be changed by operations like clone() etc. -
get
Description copied from interface:IListable
Return element at specified position -
doGet
Description copied from class:IList
Helper method for getting an element from the list. This is the only method which really gets an element. Override if you need to validity checks before getting. -
doGetAll
Description copied from class:IList
Helper method to fill the specified elements in an array. -
doAdd
Description copied from class:IList
Helper method for adding an element to the list. This is the only method which really adds an element. Override if you need to validity checks before adding. -
doSet
Description copied from class:IList
Helper method for setting an element in the list. This is the only method which really sets an element. Override if you need to validity checks before setting. -
doRemove
Description copied from class:IList
Helper method to remove an element. This is the only method which really removes an element. Override if you need to validity checks before removing. -
doRemoveAll
protected void doRemoveAll(int index, int len) Description copied from class:IList
Remove specified range of elements from list.- Overrides:
doRemoveAll
in classIList<Float>
- Parameters:
index
- index of first element to removelen
- number of elements to remove
-
doReSet
Description copied from class:IList
Sets an element at specified position. This method is used internally if existing elements will be moved etc. Override if you need to validity checks. -
move
public void move(int srcIndex, int dstIndex, int len) Description copied from class:IList
Move specified elements. Source and destination ranges may overlap. The elements which are moved away are set to null, so the size of the list does not change. -
doEnsureCapacity
protected void doEnsureCapacity(int minCapacity) Description copied from class:IList
Increases the capacity of this list instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.- Specified by:
doEnsureCapacity
in classIList<Float>
- Parameters:
minCapacity
- the desired minimum capacity
-
trimToSize
public void trimToSize()Description copied from class:IList
An application can use this operation to minimize the storage of an instance.- Specified by:
trimToSize
in classIList<Float>
-
equals
-
hashCode
public int hashCode() -
toString
-
isEmpty
public boolean isEmpty() -
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<Float>
- Overrides:
lastIndexOf
in classIList<Float>
-
remove
-
contains
-
containsAny
Description copied from class:IList
Returns true if any of the elements of the specified collection is contained in the list.- Overrides:
containsAny
in classIList<Float>
- Parameters:
coll
- collection with elements to be contained- Returns:
- true if any element is contained, false otherwise
-
containsAll
- Specified by:
containsAll
in interfaceCollection<Float>
- Specified by:
containsAll
in interfaceList<Float>
- Overrides:
containsAll
in classIList<Float>
-
removeAll
-
removeAll
-
retainAll
-
retainAll
-
toArray
Returns an array containing the specified elements in this list. -
toArray
public <T> T[] toArray(T[] array, int index, int len) Returns an array containing the specified elements in this list.- Overrides:
toArray
in classIList<Float>
- Parameters:
array
- the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purposeindex
- index of first element to copylen
- number of elements to copy- Returns:
- array containing the specified elements
- See Also:
-
toArray
Returns an array containing the specified elements in this list. -
addAll
Description copied from class:IList
Adds all of the elements in the specified collection into this list. The new elements will appear in the list in the order that they are returned by the specified collection's iterator. -
addAll
Description copied from class:IList
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.- Specified by:
addAll
in interfaceList<Float>
- Overrides:
addAll
in classIList<Float>
- Parameters:
index
- index at which to insert the first element from the specified collectioncoll
- collection containing elements to be inserted into this list- Returns:
- true if this list changed as a result of the call
-
addArray
Description copied from class:IList
Adds all specified elements into this list. -
addArray
Description copied from class:IList
Inserts the specified elements into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). -
addAll
Description copied from class:IList
Adds all of the elements in the specified list into this list. -
addAll
Description copied from class:IList
Inserts all of the elements in the specified list into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). -
removeFirstOccurrence
Description copied from class:IList
- Overrides:
removeFirstOccurrence
in classIList<Float>
-
removeLastOccurrence
Description copied from class:IList
- Overrides:
removeLastOccurrence
in classIList<Float>
-
getAll
Description copied from class:IList
Returns specified range of elements from list. -
setAll
Description copied from class:IList
Sets the specified elements. -
setAll
Description copied from class:IList
Sets the specified elements. -
setArray
Description copied from class:IList
Sets the specified elements. -
sort
Description copied from class:IList
Sort specified elements in the list using the specified comparator. -
binarySearch
Description copied from class:IList
Searches the specified range for an object using the binary search algorithm.Note that the method is defined to work with an arbitrary type <K>. This allows to search directly for a key field in the object without the need to construct an object containing the key:
persons.binarySearch("john", new SearchByName()); class SearchByName implements Comparator<Object> { public int compare(Object o1, Object o2) { String s1 = (o1 instanceof String) ? (String) o1 : ((Name) o1).getName(); String s2 = (o2 instanceof String) ? (String) o2 : ((Name) o2).getName(); return s1.compareTo(s2); } }
/- Specified by:
binarySearch
in classIList<Float>
- Parameters:
index
- index of first element to searchlen
- number of elements to searchkey
- the value to be searched forcomparator
- the comparator by which the list is ordered. A null value indicates that the elements' natural ordering should be used.- Returns:
- index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
- See Also:
-
unmodifiableList
Description copied from class:IList
Returns an unmodifiable view of this list. This method allows modules to provide users with "read-only" access to internal lists, where changes made to the original list are visible as query operations on the returned list "read through" to the specified list. Attempts to modify the returned list, whether direct or via its iterator, result in an UnsupportedOperationException. If this list is already unmodifiable, it is returned unchanged. SeeIList.immutableList()
to get an immutable copy of a list.- Specified by:
unmodifiableList
in classIList<Float>
- Returns:
- an unmodifiable view of the specified list
-
immutableList
Description copied from class:IList
Returns an immutable copy of this list. The returned list is independent from the original list, i.e. changes done later are not seen. Attempts to modify the returned list, whether direct or via its iterator, result in an UnsupportedOperationException. If this list is already immutable, it is returned unchanged. SeeIList.unmodifiableList()
to get unmodifiable view of a list.- Specified by:
immutableList
in classIList<Float>
- Returns:
- an immutable copy of the specified list
-