Class FloatArrayList
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractFloatIterable
org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList
- All Implemented Interfaces:
Externalizable, Serializable, MutableFloatCollection, FloatIterable, FloatList, MutableFloatList, OrderedFloatIterable, ReversibleFloatIterable, PrimitiveIterable
public class FloatArrayList
extends AbstractFloatIterable
implements MutableFloatList, Externalizable
FloatArrayList is similar to FastList, and is memory-optimized for float primitives.
This file was automatically generated from template file primitiveArrayList.stg.
- Since:
- 3.0.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final float[]protected float[]private static final intprivate static final longprotected intprivate static final float[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(float newItem) booleanaddAll(float... source) booleanaddAll(FloatIterable source) booleanaddAllAtIndex(int index, float... source) booleanaddAllAtIndex(int index, FloatIterable source) voidaddAtIndex(int index, float element) private voidaddAtIndexLessThanSize(int index, float element) booleanallSatisfy(FloatPredicate predicate) Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(FloatPredicate predicate) Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.voidappendString(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable.intbinarySearch(float value) boxed()private voidchunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableList<V> collect(FloatToObjectFunction<? extends V> function) Returns a new collection with the results of applying the specified function on each element of the source collection.<V, R extends Collection<V>>
Rcollect(FloatToObjectFunction<? extends V> function, R target) Same asFloatIterable.collect(FloatToObjectFunction), only the results are added to the target Collection.booleancontains(float value) Returns true if the value is contained in the FloatIterable, and false if it is not.private voidcopyItems(int sourceSize, float[] source) private float[]copyItemsWithNewCapacity(int newCapacity) intcount(FloatPredicate predicate) Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.floatdetectIfNone(FloatPredicate predicate, float ifNone) distinct()doubledotProduct(FloatList list) voideach(FloatProcedure procedure) A synonym for forEach.voidensureCapacity(int minCapacity) private voidbooleanFollows the same general contract asList.equals(Object).Returns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.voidforEachWithIndex(FloatIntProcedure procedure) floatget(int index) floatgetFirst()floatgetLast()inthashCode()Follows the same general contract asList.hashCode().intindexOf(float value) <T> TinjectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) <T> TinjectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T, ? extends T> function) intlastIndexOf(float value) floatmax()floatmin()newEmpty()Creates a new empty FloatArrayList.private IndexOutOfBoundsExceptionnewIndexOutOfBoundsException(int index) static FloatArrayListnewList(FloatIterable source) static FloatArrayListnewListWith(float... elements) Creates a new list using the passedelementsargument as the backing store.static FloatArrayListnewWithNValues(int size, float value) voidreject(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.<R extends MutableFloatCollection>
Rreject(FloatPredicate predicate, R target) Same asFloatIterable.reject(FloatPredicate), only the results are added to the target MutableFloatCollection.booleanremove(float value) booleanremoveAll(float... source) booleanremoveAll(FloatIterable source) floatremoveAtIndex(int index) booleanremoveIf(FloatPredicate predicate) booleanretainAll(float... source) booleanretainAll(FloatIterable source) select(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.<R extends MutableFloatCollection>
Rselect(FloatPredicate predicate, R target) Same asFloatIterable.select(FloatPredicate), only the results are added to the target MutableFloatCollection.floatset(int index, float element) private voidshiftElementsAtIndex(int index, int sourceSize) intsize()Returns the number of items in this iterable.private intsizePlusFiftyPercent(int oldSize) sortThis()Sorts this list mutating its contents and returns the same mutable list (this).sortThis(FloatComparator comparator) Sorts the internal data structure of this list and returns the list itself as a convenience.subList(int fromIndex, int toIndex) doublesum()voidswap(int index1, int index2) private voidthrowOutOfBounds(int index) float[]toArray()Converts the FloatIterable to a primitive float array.float[]toArray(float[] target) Converts the FloatIterable to a primitive float array.Returns an immutable copy of this list.toStack()Converts the collection to a FloatStack.private voidtransferItemsToNewArrayWithCapacity(int newCapacity) voidprivate voidwipeAndResetTheEnd(int newCurrentFilledIndex) with(float element) with(float element1, float element2) with(float element1, float element2, float element3) with(float element1, float element2, float element3, float... elements) withAll(FloatIterable elements) private FloatArrayListwithArrayCopy(float[] elements, int begin, int length) without(float element) withoutAll(FloatIterable elements) static FloatArrayListwrapCopy(float... array) Creates a new list by first copying the array passed in.void<T> MutableList<FloatObjectPair<T>> Returns aMutableListformed from thisMutableFloatListand aListIterableby combining corresponding elements in pairs.zipFloat(FloatIterable iterable) Returns aMutableListformed from thisMutableFloatListand anotherFloatListby combining corresponding elements in pairs.Methods inherited from class AbstractFloatIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface FloatIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface FloatList
forEachInBothMethods inherited from interface MutableFloatList
collectWithIndex, rejectWithIndex, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tapMethods inherited from interface OrderedFloatIterable
collectWithIndex, rejectWithIndex, selectWithIndexMethods inherited from interface PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
DEFAULT_SIZED_EMPTY_ARRAY
private static final float[] DEFAULT_SIZED_EMPTY_ARRAY -
ZERO_SIZED_ARRAY
private static final float[] ZERO_SIZED_ARRAY -
MAXIMUM_ARRAY_SIZE
private static final int MAXIMUM_ARRAY_SIZE- See Also:
-
size
protected int size -
items
protected transient float[] items
-
-
Constructor Details
-
FloatArrayList
public FloatArrayList() -
FloatArrayList
public FloatArrayList(int initialCapacity) -
FloatArrayList
public FloatArrayList(float... array)
-
-
Method Details
-
newListWith
Creates a new list using the passedelementsargument as the backing store.!!! WARNING: This method uses the passed in array, so can be very unsafe if the original array is held onto anywhere else. !!!
-
newList
-
newWithNValues
-
wrapCopy
Creates a new list by first copying the array passed in. -
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
clear
public void clear()- Specified by:
clearin interfaceMutableFloatCollection
-
contains
public boolean contains(float value) Description copied from interface:FloatIterableReturns true if the value is contained in the FloatIterable, and false if it is not.- Specified by:
containsin interfaceFloatIterable
-
get
-
newIndexOutOfBoundsException
-
getFirst
public float getFirst()- Specified by:
getFirstin interfaceOrderedFloatIterable
-
getLast
public float getLast()- Specified by:
getLastin interfaceReversibleFloatIterable
-
checkEmpty
private void checkEmpty() -
indexOf
public int indexOf(float value) - Specified by:
indexOfin interfaceOrderedFloatIterable
-
lastIndexOf
public int lastIndexOf(float value) - Specified by:
lastIndexOfin interfaceFloatList
-
trimToSize
public void trimToSize() -
transferItemsToNewArrayWithCapacity
private void transferItemsToNewArrayWithCapacity(int newCapacity) -
copyItemsWithNewCapacity
private float[] copyItemsWithNewCapacity(int newCapacity) -
sizePlusFiftyPercent
private int sizePlusFiftyPercent(int oldSize) -
ensureCapacity
public void ensureCapacity(int minCapacity) -
ensureCapacityForAdd
private void ensureCapacityForAdd() -
add
public boolean add(float newItem) - Specified by:
addin interfaceMutableFloatCollection
-
addAll
public boolean addAll(float... source) - Specified by:
addAllin interfaceMutableFloatCollection
-
addAll
- Specified by:
addAllin interfaceMutableFloatCollection
-
copyItems
private void copyItems(int sourceSize, float[] source) -
throwOutOfBounds
private void throwOutOfBounds(int index) -
addAtIndex
public void addAtIndex(int index, float element) - Specified by:
addAtIndexin interfaceMutableFloatList
-
addAtIndexLessThanSize
private void addAtIndexLessThanSize(int index, float element) -
addAllAtIndex
public boolean addAllAtIndex(int index, float... source) - Specified by:
addAllAtIndexin interfaceMutableFloatList
-
addAllAtIndex
- Specified by:
addAllAtIndexin interfaceMutableFloatList
-
shiftElementsAtIndex
private void shiftElementsAtIndex(int index, int sourceSize) -
remove
public boolean remove(float value) - Specified by:
removein interfaceMutableFloatCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableFloatCollection
-
wipeAndResetTheEnd
private void wipeAndResetTheEnd(int newCurrentFilledIndex) -
removeAll
- Specified by:
removeAllin interfaceMutableFloatCollection
-
removeAll
public boolean removeAll(float... source) - Specified by:
removeAllin interfaceMutableFloatCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
retainAll
public boolean retainAll(float... source) - Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
removeAtIndex
public float removeAtIndex(int index) - Specified by:
removeAtIndexin interfaceMutableFloatList
-
set
public float set(int index, float element) - Specified by:
setin interfaceMutableFloatList
-
swap
public void swap(int index1, int index2) - Specified by:
swapin interfaceMutableFloatList
-
with
- Specified by:
within interfaceMutableFloatCollection- Specified by:
within interfaceMutableFloatList
-
without
- Specified by:
withoutin interfaceMutableFloatCollection- Specified by:
withoutin interfaceMutableFloatList
-
withAll
- Specified by:
withAllin interfaceMutableFloatCollection- Specified by:
withAllin interfaceMutableFloatList
-
withoutAll
- Specified by:
withoutAllin interfaceMutableFloatCollection- Specified by:
withoutAllin interfaceMutableFloatList
-
with
-
with
-
with
-
withArrayCopy
-
floatIterator
Description copied from interface:FloatIterableReturns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.- Specified by:
floatIteratorin interfaceFloatIterable- Specified by:
floatIteratorin interfaceMutableFloatCollection
-
each
Description copied from interface:FloatIterableA synonym for forEach.- Specified by:
eachin interfaceFloatIterable- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceOrderedFloatIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceFloatIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoWithIndexin interfaceOrderedFloatIterable- Specified by:
injectIntoWithIndexin interfaceReversibleFloatIterable
-
chunk
Description copied from interface:FloatIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceFloatIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingFloatIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:FloatIterableReturns a count of the number of elements in the FloatIterable that return true for the specified predicate.- Specified by:
countin interfaceFloatIterable
-
anySatisfy
Description copied from interface:FloatIterableReturns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceFloatIterable
-
allSatisfy
Description copied from interface:FloatIterableReturns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceFloatIterable
-
select
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.- Specified by:
selectin interfaceFloatIterable- Specified by:
selectin interfaceFloatList- Specified by:
selectin interfaceMutableFloatCollection- Specified by:
selectin interfaceMutableFloatList- Specified by:
selectin interfaceOrderedFloatIterable- Specified by:
selectin interfaceReversibleFloatIterable
-
select
Description copied from interface:FloatIterableSame asFloatIterable.select(FloatPredicate), only the results are added to the target MutableFloatCollection.- Specified by:
selectin interfaceFloatIterable- Since:
- 8.1.
-
reject
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.- Specified by:
rejectin interfaceFloatIterable- Specified by:
rejectin interfaceFloatList- Specified by:
rejectin interfaceMutableFloatCollection- Specified by:
rejectin interfaceMutableFloatList- Specified by:
rejectin interfaceOrderedFloatIterable- Specified by:
rejectin interfaceReversibleFloatIterable
-
reject
Description copied from interface:FloatIterableSame asFloatIterable.reject(FloatPredicate), only the results are added to the target MutableFloatCollection.- Specified by:
rejectin interfaceFloatIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceFloatIterable
-
collect
Description copied from interface:FloatIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collectin interfaceFloatIterable- Specified by:
collectin interfaceFloatList- Specified by:
collectin interfaceMutableFloatCollection- Specified by:
collectin interfaceMutableFloatList- Specified by:
collectin interfaceOrderedFloatIterable- Specified by:
collectin interfaceReversibleFloatIterable
-
collect
public <V, R extends Collection<V>> R collect(FloatToObjectFunction<? extends V> function, R target) Description copied from interface:FloatIterableSame asFloatIterable.collect(FloatToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceFloatIterable- Since:
- 8.1.
-
max
public float max()- Specified by:
maxin interfaceFloatIterable
-
min
public float min()- Specified by:
minin interfaceFloatIterable
-
sum
public double sum()- Specified by:
sumin interfaceFloatIterable
-
dotProduct
- Specified by:
dotProductin interfaceFloatList
-
toArray
public float[] toArray()Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array.- Specified by:
toArrayin interfaceFloatIterable
-
toArray
public float[] toArray(float[] target) Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArrayin interfaceFloatIterable
-
equals
-
hashCode
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableFloatCollection- Specified by:
asUnmodifiablein interfaceMutableFloatList
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableFloatCollection- Specified by:
asSynchronizedin interfaceMutableFloatList
-
toImmutable
Description copied from interface:MutableFloatListReturns an immutable copy of this list.- Specified by:
toImmutablein interfaceFloatList- Specified by:
toImmutablein interfaceMutableFloatCollection- Specified by:
toImmutablein interfaceMutableFloatList
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
asReversed
- Specified by:
asReversedin interfaceReversibleFloatIterable
-
reverseThis
- Specified by:
reverseThisin interfaceMutableFloatList
-
sortThis
Description copied from interface:MutableFloatListSorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThisin interfaceMutableFloatList
-
sortThis
Description copied from interface:MutableFloatListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableFloatList
-
toReversed
- Specified by:
toReversedin interfaceFloatList- Specified by:
toReversedin interfaceMutableFloatList- Specified by:
toReversedin interfaceReversibleFloatIterable
-
binarySearch
public int binarySearch(float value) - Specified by:
binarySearchin interfaceFloatList
-
distinct
- Specified by:
distinctin interfaceFloatList- Specified by:
distinctin interfaceMutableFloatList- Specified by:
distinctin interfaceReversibleFloatIterable
-
subList
- Specified by:
subListin interfaceFloatList- Specified by:
subListin interfaceMutableFloatList- See Also:
-
zipFloat
Description copied from interface:MutableFloatListReturns aMutableListformed from thisMutableFloatListand anotherFloatListby combining corresponding elements in pairs. If one of the twoFloatLists is longer than the other, its remaining elements are ignored.- Specified by:
zipFloatin interfaceFloatList- Specified by:
zipFloatin interfaceMutableFloatList- Since:
- 9.1.
-
newEmpty
Creates a new empty FloatArrayList.- Specified by:
newEmptyin interfaceMutableFloatCollection- Specified by:
newEmptyin interfaceMutableFloatList- Since:
- 9.2.
-
zip
Description copied from interface:MutableFloatListReturns aMutableListformed from thisMutableFloatListand aListIterableby combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zipin interfaceFloatList- Specified by:
zipin interfaceMutableFloatList- Since:
- 9.1.
-
boxed
- Specified by:
boxedin interfaceMutableFloatList
-
toStack
Description copied from interface:OrderedFloatIterableConverts the collection to a FloatStack.- Specified by:
toStackin interfaceOrderedFloatIterable
-