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:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description FloatArrayList()
FloatArrayList(float... array)
FloatArrayList(int initialCapacity)
-
Method Summary
Modifier and Type Method Description boolean
add(float newItem)
boolean
addAll(float... source)
boolean
addAll(FloatIterable source)
boolean
addAllAtIndex(int index, float... source)
boolean
addAllAtIndex(int index, FloatIterable source)
void
addAtIndex(int index, float element)
boolean
allSatisfy(FloatPredicate predicate)
Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(FloatPredicate predicate)
Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.void
appendString(Appendable appendable, String start, String separator, String end)
Prints a string representation of this collection onto the givenAppendable
.LazyFloatIterable
asReversed()
MutableFloatList
asSynchronized()
MutableFloatList
asUnmodifiable()
int
binarySearch(float value)
RichIterable<FloatIterable>
chunk(int size)
Partitions elements in fixed size chunks.void
clear()
<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.boolean
contains(float value)
Returns true if the value is contained in the FloatIterable, and false if it is not.int
count(FloatPredicate predicate)
Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.float
detectIfNone(FloatPredicate predicate, float ifNone)
MutableFloatList
distinct()
double
dotProduct(FloatList list)
void
each(FloatProcedure procedure)
A synonym for forEach.void
ensureCapacity(int minCapacity)
boolean
equals(Object otherList)
Follows the same general contract asList.equals(Object)
.MutableFloatIterator
floatIterator()
Returns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.void
forEach(FloatProcedure procedure)
Applies the FloatProcedure to each element in the FloatIterable.void
forEachWithIndex(FloatIntProcedure procedure)
float
get(int index)
float
getFirst()
float
getLast()
int
hashCode()
Follows the same general contract asList.hashCode()
.int
indexOf(float value)
<T> T
injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T,? extends T> function)
<T> T
injectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T,? extends T> function)
int
lastIndexOf(float value)
float
max()
float
min()
FloatArrayList
newEmpty()
Creates a new empty FloatArrayList.static FloatArrayList
newList(FloatIterable source)
static FloatArrayList
newListWith(float... elements)
Creates a new list using the passedelements
argument as the backing store.static FloatArrayList
newWithNValues(int size, float value)
boolean
noneSatisfy(FloatPredicate predicate)
Returns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.void
readExternal(ObjectInput in)
FloatArrayList
reject(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.boolean
remove(float value)
boolean
removeAll(float... source)
boolean
removeAll(FloatIterable source)
float
removeAtIndex(int index)
boolean
removeIf(FloatPredicate predicate)
boolean
retainAll(float... source)
boolean
retainAll(FloatIterable source)
FloatArrayList
reverseThis()
FloatArrayList
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.float
set(int index, float element)
int
size()
Returns the number of items in this iterable.FloatArrayList
sortThis()
Sorts this list mutating its contents and returns the same mutable list (this).FloatArrayList
sortThis(FloatComparator comparator)
Sorts the internal data structure of this list and returns the list itself as a convenience.MutableFloatList
subList(int fromIndex, int toIndex)
double
sum()
void
swap(int index1, int index2)
float[]
toArray()
Converts the FloatIterable to a primitive float array.float[]
toArray(float[] target)
Converts the FloatIterable to a primitive float array.ImmutableFloatList
toImmutable()
Returns an immutable copy of this list.FloatArrayList
toReversed()
void
trimToSize()
FloatArrayList
with(float element)
FloatArrayList
with(float element1, float element2)
FloatArrayList
with(float element1, float element2, float element3)
FloatArrayList
with(float element1, float element2, float element3, float... elements)
FloatArrayList
withAll(FloatIterable elements)
FloatArrayList
without(float element)
FloatArrayList
withoutAll(FloatIterable elements)
static FloatArrayList
wrapCopy(float... array)
Creates a new list by first copying the array passed in.void
writeExternal(ObjectOutput out)
<T> MutableList<FloatObjectPair<T>>
zip(Iterable<T> iterable)
Returns aMutableList
formed from thisMutableFloatList
and aListIterable
by combining corresponding elements in pairs.MutableList<FloatFloatPair>
zipFloat(FloatIterable iterable)
Returns aMutableList
formed from thisMutableFloatList
and anotherFloatList
by combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractFloatIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
Methods inherited from interface org.eclipse.collections.api.FloatIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableFloatList
collectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tap
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedFloatIterable
collectWithIndex
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
FloatArrayList
public FloatArrayList() -
FloatArrayList
public FloatArrayList(int initialCapacity) -
FloatArrayList
public FloatArrayList(float... array)
-
-
Method Details
-
newListWith
Creates a new list using the passedelements
argument 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:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
clear
public void clear()- Specified by:
clear
in interfaceMutableFloatCollection
-
contains
public boolean contains(float value)Description copied from interface:FloatIterable
Returns true if the value is contained in the FloatIterable, and false if it is not.- Specified by:
contains
in interfaceFloatIterable
-
get
public float get(int index) -
getFirst
public float getFirst()- Specified by:
getFirst
in interfaceOrderedFloatIterable
-
getLast
public float getLast()- Specified by:
getLast
in interfaceReversibleFloatIterable
-
indexOf
public int indexOf(float value)- Specified by:
indexOf
in interfaceOrderedFloatIterable
-
lastIndexOf
public int lastIndexOf(float value)- Specified by:
lastIndexOf
in interfaceFloatList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(float newItem)- Specified by:
add
in interfaceMutableFloatCollection
-
addAll
public boolean addAll(float... source)- Specified by:
addAll
in interfaceMutableFloatCollection
-
addAll
- Specified by:
addAll
in interfaceMutableFloatCollection
-
addAtIndex
public void addAtIndex(int index, float element)- Specified by:
addAtIndex
in interfaceMutableFloatList
-
addAllAtIndex
public boolean addAllAtIndex(int index, float... source)- Specified by:
addAllAtIndex
in interfaceMutableFloatList
-
addAllAtIndex
- Specified by:
addAllAtIndex
in interfaceMutableFloatList
-
remove
public boolean remove(float value)- Specified by:
remove
in interfaceMutableFloatCollection
-
removeIf
- Specified by:
removeIf
in interfaceMutableFloatCollection
-
removeAll
- Specified by:
removeAll
in interfaceMutableFloatCollection
-
removeAll
public boolean removeAll(float... source)- Specified by:
removeAll
in interfaceMutableFloatCollection
-
retainAll
- Specified by:
retainAll
in interfaceMutableFloatCollection
- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(float... source)- Specified by:
retainAll
in interfaceMutableFloatCollection
- See Also:
Collection.retainAll(Collection)
-
removeAtIndex
public float removeAtIndex(int index)- Specified by:
removeAtIndex
in interfaceMutableFloatList
-
set
public float set(int index, float element)- Specified by:
set
in interfaceMutableFloatList
-
swap
public void swap(int index1, int index2)- Specified by:
swap
in interfaceMutableFloatList
-
with
- Specified by:
with
in interfaceMutableFloatCollection
- Specified by:
with
in interfaceMutableFloatList
-
without
- Specified by:
without
in interfaceMutableFloatCollection
- Specified by:
without
in interfaceMutableFloatList
-
withAll
- Specified by:
withAll
in interfaceMutableFloatCollection
- Specified by:
withAll
in interfaceMutableFloatList
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableFloatCollection
- Specified by:
withoutAll
in interfaceMutableFloatList
-
with
-
with
-
with
-
floatIterator
Description copied from interface:FloatIterable
Returns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.- Specified by:
floatIterator
in interfaceFloatIterable
- Specified by:
floatIterator
in interfaceMutableFloatCollection
-
forEach
Description copied from interface:FloatIterable
Applies the FloatProcedure to each element in the FloatIterable.- Specified by:
forEach
in interfaceFloatIterable
-
each
Description copied from interface:FloatIterable
A synonym for forEach.- Specified by:
each
in interfaceFloatIterable
- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndex
in interfaceOrderedFloatIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T,? extends T> function)- Specified by:
injectInto
in interfaceFloatIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndex
in interfaceOrderedFloatIterable
- Specified by:
injectIntoWithIndex
in interfaceReversibleFloatIterable
-
chunk
Description copied from interface:FloatIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceFloatIterable
- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingFloatIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:FloatIterable
Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.- Specified by:
count
in interfaceFloatIterable
-
anySatisfy
Description copied from interface:FloatIterable
Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceFloatIterable
-
allSatisfy
Description copied from interface:FloatIterable
Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceFloatIterable
-
noneSatisfy
Description copied from interface:FloatIterable
Returns true if none of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceFloatIterable
-
select
Description copied from interface:FloatIterable
Returns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.- Specified by:
select
in interfaceFloatIterable
- Specified by:
select
in interfaceFloatList
- Specified by:
select
in interfaceMutableFloatCollection
- Specified by:
select
in interfaceMutableFloatList
- Specified by:
select
in interfaceOrderedFloatIterable
- Specified by:
select
in interfaceReversibleFloatIterable
-
select
Description copied from interface:FloatIterable
Same asFloatIterable.select(FloatPredicate)
, only the results are added to the target MutableFloatCollection.- Specified by:
select
in interfaceFloatIterable
- Since:
- 8.1.
-
reject
Description copied from interface:FloatIterable
Returns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.- Specified by:
reject
in interfaceFloatIterable
- Specified by:
reject
in interfaceFloatList
- Specified by:
reject
in interfaceMutableFloatCollection
- Specified by:
reject
in interfaceMutableFloatList
- Specified by:
reject
in interfaceOrderedFloatIterable
- Specified by:
reject
in interfaceReversibleFloatIterable
-
reject
Description copied from interface:FloatIterable
Same asFloatIterable.reject(FloatPredicate)
, only the results are added to the target MutableFloatCollection.- Specified by:
reject
in interfaceFloatIterable
- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNone
in interfaceFloatIterable
-
collect
Description copied from interface:FloatIterable
Returns 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:
collect
in interfaceFloatIterable
- Specified by:
collect
in interfaceFloatList
- Specified by:
collect
in interfaceMutableFloatCollection
- Specified by:
collect
in interfaceMutableFloatList
- Specified by:
collect
in interfaceOrderedFloatIterable
- Specified by:
collect
in interfaceReversibleFloatIterable
-
collect
public <V, R extends Collection<V>> R collect(FloatToObjectFunction<? extends V> function, R target)Description copied from interface:FloatIterable
Same asFloatIterable.collect(FloatToObjectFunction)
, only the results are added to the target Collection.- Specified by:
collect
in interfaceFloatIterable
- Since:
- 8.1.
-
max
public float max()- Specified by:
max
in interfaceFloatIterable
-
min
public float min()- Specified by:
min
in interfaceFloatIterable
-
sum
public double sum()- Specified by:
sum
in interfaceFloatIterable
-
dotProduct
- Specified by:
dotProduct
in interfaceFloatList
-
toArray
public float[] toArray()Description copied from interface:FloatIterable
Converts the FloatIterable to a primitive float array.- Specified by:
toArray
in interfaceFloatIterable
-
toArray
public float[] toArray(float[] target)Description copied from interface:FloatIterable
Converts 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:
toArray
in interfaceFloatIterable
-
equals
Description copied from interface:FloatList
Follows the same general contract asList.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:FloatList
Follows the same general contract asList.hashCode()
. -
appendString
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableFloatCollection
- Specified by:
asUnmodifiable
in interfaceMutableFloatList
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableFloatCollection
- Specified by:
asSynchronized
in interfaceMutableFloatList
-
toImmutable
Description copied from interface:MutableFloatList
Returns an immutable copy of this list.- Specified by:
toImmutable
in interfaceFloatList
- Specified by:
toImmutable
in interfaceMutableFloatCollection
- Specified by:
toImmutable
in interfaceMutableFloatList
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
asReversed
- Specified by:
asReversed
in interfaceReversibleFloatIterable
-
reverseThis
- Specified by:
reverseThis
in interfaceMutableFloatList
-
sortThis
Description copied from interface:MutableFloatList
Sorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThis
in interfaceMutableFloatList
-
sortThis
Description copied from interface:MutableFloatList
Sorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThis
in interfaceMutableFloatList
-
toReversed
- Specified by:
toReversed
in interfaceFloatList
- Specified by:
toReversed
in interfaceMutableFloatList
- Specified by:
toReversed
in interfaceReversibleFloatIterable
-
binarySearch
public int binarySearch(float value)- Specified by:
binarySearch
in interfaceFloatList
-
distinct
- Specified by:
distinct
in interfaceFloatList
- Specified by:
distinct
in interfaceMutableFloatList
- Specified by:
distinct
in interfaceReversibleFloatIterable
-
subList
- Specified by:
subList
in interfaceFloatList
- Specified by:
subList
in interfaceMutableFloatList
- See Also:
List.subList(int fromIndex, int toIndex)
-
zipFloat
Description copied from interface:MutableFloatList
Returns aMutableList
formed from thisMutableFloatList
and anotherFloatList
by combining corresponding elements in pairs. If one of the twoFloatList
s is longer than the other, its remaining elements are ignored.- Specified by:
zipFloat
in interfaceFloatList
- Specified by:
zipFloat
in interfaceMutableFloatList
- Since:
- 9.1.
-
newEmpty
Creates a new empty FloatArrayList.- Specified by:
newEmpty
in interfaceMutableFloatCollection
- Specified by:
newEmpty
in interfaceMutableFloatList
- Since:
- 9.2.
-
zip
Description copied from interface:MutableFloatList
Returns aMutableList
formed from thisMutableFloatList
and aListIterable
by combining corresponding elements in pairs. If one of the two Lists is longer than the other, its remaining elements are ignored.- Specified by:
zip
in interfaceFloatList
- Specified by:
zip
in interfaceMutableFloatList
- Since:
- 9.1.
-