Class LongArrayList
- java.lang.Object
-
- org.eclipse.collections.impl.primitive.AbstractLongIterable
-
- org.eclipse.collections.impl.list.mutable.primitive.LongArrayList
-
- All Implemented Interfaces:
Externalizable,Serializable,MutableLongCollection,LongList,MutableLongList,LongIterable,OrderedLongIterable,ReversibleLongIterable,PrimitiveIterable
public class LongArrayList extends AbstractLongIterable implements MutableLongList, Externalizable
LongArrayList is similar to FastList, and is memory-optimized for long primitives. This file was automatically generated from template file primitiveArrayList.stg.- Since:
- 3.0.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LongArrayList()LongArrayList(int initialCapacity)LongArrayList(long... array)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(long newItem)booleanaddAll(long... source)booleanaddAll(LongIterable source)booleanaddAllAtIndex(int index, long... source)booleanaddAllAtIndex(int index, LongIterable source)voidaddAtIndex(int index, long element)booleanallSatisfy(LongPredicate predicate)booleananySatisfy(LongPredicate predicate)voidappendString(Appendable appendable, String start, String separator, String end)LazyLongIterableasReversed()MutableLongListasSynchronized()MutableLongListasUnmodifiable()intbinarySearch(long value)MutableList<Long>boxed()RichIterable<LongIterable>chunk(int size)voidclear()<V> MutableList<V>collect(LongToObjectFunction<? extends V> function)<V,R extends Collection<V>>
Rcollect(LongToObjectFunction<? extends V> function, R target)booleancontains(long value)intcount(LongPredicate predicate)longdetectIfNone(LongPredicate predicate, long ifNone)MutableLongListdistinct()longdotProduct(LongList list)voideach(LongProcedure procedure)voidensureCapacity(int minCapacity)booleanequals(Object otherList)voidforEachWithIndex(LongIntProcedure procedure)longget(int index)longgetFirst()longgetLast()inthashCode()intindexOf(long value)<T> TinjectInto(T injectedValue, ObjectLongToObjectFunction<? super T,? extends T> function)<T> TinjectIntoWithIndex(T injectedValue, ObjectLongIntToObjectFunction<? super T,? extends T> function)intlastIndexOf(long value)MutableLongIteratorlongIterator()longmax()longmin()LongArrayListnewEmpty()Creates a new empty LongArrayList.static LongArrayListnewList(LongIterable source)static LongArrayListnewListWith(long... elements)Creates a new list using the passedelementsargument as the backing store.static LongArrayListnewWithNValues(int size, long value)voidreadExternal(ObjectInput in)LongArrayListreject(LongPredicate predicate)<R extends MutableLongCollection>
Rreject(LongPredicate predicate, R target)booleanremove(long value)booleanremoveAll(long... source)booleanremoveAll(LongIterable source)longremoveAtIndex(int index)booleanremoveIf(LongPredicate predicate)booleanretainAll(long... source)booleanretainAll(LongIterable source)LongArrayListreverseThis()LongArrayListselect(LongPredicate predicate)<R extends MutableLongCollection>
Rselect(LongPredicate predicate, R target)longset(int index, long element)intsize()LongArrayListsortThis()LongArrayListsortThis(LongComparator comparator)Spliterator.OfLongspliterator()MutableLongListsubList(int fromIndex, int toIndex)longsum()voidswap(int index1, int index2)long[]toArray()long[]toArray(long[] target)ImmutableLongListtoImmutable()LongArrayListtoReversed()voidtrimToSize()LongArrayListwith(long element)LongArrayListwith(long element1, long element2)LongArrayListwith(long element1, long element2, long element3)LongArrayListwith(long element1, long element2, long element3, long... elements)LongArrayListwithAll(LongIterable elements)LongArrayListwithout(long element)LongArrayListwithoutAll(LongIterable elements)static LongArrayListwrapCopy(long... array)Creates a new list by first copying the array passed in.voidwriteExternal(ObjectOutput out)<T> MutableList<LongObjectPair<T>>zip(Iterable<T> iterable)MutableList<LongLongPair>zipLong(LongIterable iterable)-
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractLongIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
-
Methods inherited from interface org.eclipse.collections.api.LongIterable
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, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.LongList
forEachInBoth, primitiveParallelStream, primitiveStream
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableLongList
collectWithIndex, rejectWithIndex, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tap
-
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedLongIterable
collectWithIndex, rejectWithIndex, selectWithIndex
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
-
-
-
Method Detail
-
newListWith
public static LongArrayList newListWith(long... elements)
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
public static LongArrayList newList(LongIterable source)
-
newWithNValues
public static LongArrayList newWithNValues(int size, long value)
-
wrapCopy
public static LongArrayList wrapCopy(long... array)
Creates a new list by first copying the array passed in.
-
size
public int size()
- Specified by:
sizein interfacePrimitiveIterable
-
clear
public void clear()
- Specified by:
clearin interfaceMutableLongCollection
-
contains
public boolean contains(long value)
- Specified by:
containsin interfaceLongIterable
-
getFirst
public long getFirst()
- Specified by:
getFirstin interfaceOrderedLongIterable
-
getLast
public long getLast()
- Specified by:
getLastin interfaceReversibleLongIterable
-
indexOf
public int indexOf(long value)
- Specified by:
indexOfin interfaceOrderedLongIterable
-
lastIndexOf
public int lastIndexOf(long value)
- Specified by:
lastIndexOfin interfaceLongList
-
trimToSize
public void trimToSize()
-
ensureCapacity
public void ensureCapacity(int minCapacity)
-
add
public boolean add(long newItem)
- Specified by:
addin interfaceMutableLongCollection
-
addAll
public boolean addAll(long... source)
- Specified by:
addAllin interfaceMutableLongCollection
-
addAll
public boolean addAll(LongIterable source)
- Specified by:
addAllin interfaceMutableLongCollection
-
addAtIndex
public void addAtIndex(int index, long element)- Specified by:
addAtIndexin interfaceMutableLongList
-
addAllAtIndex
public boolean addAllAtIndex(int index, long... source)- Specified by:
addAllAtIndexin interfaceMutableLongList
-
addAllAtIndex
public boolean addAllAtIndex(int index, LongIterable source)- Specified by:
addAllAtIndexin interfaceMutableLongList
-
remove
public boolean remove(long value)
- Specified by:
removein interfaceMutableLongCollection
-
removeIf
public boolean removeIf(LongPredicate predicate)
- Specified by:
removeIfin interfaceMutableLongCollection
-
removeAll
public boolean removeAll(LongIterable source)
- Specified by:
removeAllin interfaceMutableLongCollection
-
removeAll
public boolean removeAll(long... source)
- Specified by:
removeAllin interfaceMutableLongCollection
-
retainAll
public boolean retainAll(LongIterable source)
- Specified by:
retainAllin interfaceMutableLongCollection
-
retainAll
public boolean retainAll(long... source)
- Specified by:
retainAllin interfaceMutableLongCollection
-
removeAtIndex
public long removeAtIndex(int index)
- Specified by:
removeAtIndexin interfaceMutableLongList
-
set
public long set(int index, long element)- Specified by:
setin interfaceMutableLongList
-
swap
public void swap(int index1, int index2)- Specified by:
swapin interfaceMutableLongList
-
with
public LongArrayList with(long element)
- Specified by:
within interfaceMutableLongCollection- Specified by:
within interfaceMutableLongList
-
without
public LongArrayList without(long element)
- Specified by:
withoutin interfaceMutableLongCollection- Specified by:
withoutin interfaceMutableLongList
-
withAll
public LongArrayList withAll(LongIterable elements)
- Specified by:
withAllin interfaceMutableLongCollection- Specified by:
withAllin interfaceMutableLongList
-
withoutAll
public LongArrayList withoutAll(LongIterable elements)
- Specified by:
withoutAllin interfaceMutableLongCollection- Specified by:
withoutAllin interfaceMutableLongList
-
with
public LongArrayList with(long element1, long element2)
-
with
public LongArrayList with(long element1, long element2, long element3)
-
with
public LongArrayList with(long element1, long element2, long element3, long... elements)
-
longIterator
public MutableLongIterator longIterator()
- Specified by:
longIteratorin interfaceLongIterable- Specified by:
longIteratorin interfaceMutableLongCollection
-
each
public void each(LongProcedure procedure)
- Specified by:
eachin interfaceLongIterable- Since:
- 7.0.
-
forEachWithIndex
public void forEachWithIndex(LongIntProcedure procedure)
- Specified by:
forEachWithIndexin interfaceOrderedLongIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectLongToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceLongIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectLongIntToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoWithIndexin interfaceOrderedLongIterable- Specified by:
injectIntoWithIndexin interfaceReversibleLongIterable
-
chunk
public RichIterable<LongIterable> chunk(int size)
- Specified by:
chunkin interfaceLongIterable
-
count
public int count(LongPredicate predicate)
- Specified by:
countin interfaceLongIterable
-
anySatisfy
public boolean anySatisfy(LongPredicate predicate)
- Specified by:
anySatisfyin interfaceLongIterable
-
allSatisfy
public boolean allSatisfy(LongPredicate predicate)
- Specified by:
allSatisfyin interfaceLongIterable
-
select
public LongArrayList select(LongPredicate predicate)
- Specified by:
selectin interfaceLongIterable- Specified by:
selectin interfaceLongList- Specified by:
selectin interfaceMutableLongCollection- Specified by:
selectin interfaceMutableLongList- Specified by:
selectin interfaceOrderedLongIterable- Specified by:
selectin interfaceReversibleLongIterable
-
select
public <R extends MutableLongCollection> R select(LongPredicate predicate, R target)
- Specified by:
selectin interfaceLongIterable- Since:
- 8.1.
-
reject
public LongArrayList reject(LongPredicate predicate)
- Specified by:
rejectin interfaceLongIterable- Specified by:
rejectin interfaceLongList- Specified by:
rejectin interfaceMutableLongCollection- Specified by:
rejectin interfaceMutableLongList- Specified by:
rejectin interfaceOrderedLongIterable- Specified by:
rejectin interfaceReversibleLongIterable
-
reject
public <R extends MutableLongCollection> R reject(LongPredicate predicate, R target)
- Specified by:
rejectin interfaceLongIterable- Since:
- 8.1.
-
detectIfNone
public long detectIfNone(LongPredicate predicate, long ifNone)
- Specified by:
detectIfNonein interfaceLongIterable
-
collect
public <V> MutableList<V> collect(LongToObjectFunction<? extends V> function)
- Specified by:
collectin interfaceLongIterable- Specified by:
collectin interfaceLongList- Specified by:
collectin interfaceMutableLongCollection- Specified by:
collectin interfaceMutableLongList- Specified by:
collectin interfaceOrderedLongIterable- Specified by:
collectin interfaceReversibleLongIterable
-
collect
public <V,R extends Collection<V>> R collect(LongToObjectFunction<? extends V> function, R target)
- Specified by:
collectin interfaceLongIterable- Since:
- 8.1.
-
max
public long max()
- Specified by:
maxin interfaceLongIterable
-
min
public long min()
- Specified by:
minin interfaceLongIterable
-
sum
public long sum()
- Specified by:
sumin interfaceLongIterable
-
dotProduct
public long dotProduct(LongList list)
- Specified by:
dotProductin interfaceLongList
-
toArray
public long[] toArray()
- Specified by:
toArrayin interfaceLongIterable
-
toArray
public long[] toArray(long[] target)
- Specified by:
toArrayin interfaceLongIterable
-
equals
public boolean equals(Object otherList)
-
hashCode
public int hashCode()
-
appendString
public void appendString(Appendable appendable, String start, String separator, String end)
- Specified by:
appendStringin interfacePrimitiveIterable
-
asUnmodifiable
public MutableLongList asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableLongCollection- Specified by:
asUnmodifiablein interfaceMutableLongList
-
asSynchronized
public MutableLongList asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableLongCollection- Specified by:
asSynchronizedin interfaceMutableLongList
-
toImmutable
public ImmutableLongList toImmutable()
- Specified by:
toImmutablein interfaceLongList- Specified by:
toImmutablein interfaceMutableLongCollection- Specified by:
toImmutablein interfaceMutableLongList
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
asReversed
public LazyLongIterable asReversed()
- Specified by:
asReversedin interfaceReversibleLongIterable
-
reverseThis
public LongArrayList reverseThis()
- Specified by:
reverseThisin interfaceMutableLongList
-
sortThis
public LongArrayList sortThis()
- Specified by:
sortThisin interfaceMutableLongList
-
sortThis
public LongArrayList sortThis(LongComparator comparator)
- Specified by:
sortThisin interfaceMutableLongList
-
toReversed
public LongArrayList toReversed()
- Specified by:
toReversedin interfaceLongList- Specified by:
toReversedin interfaceMutableLongList- Specified by:
toReversedin interfaceReversibleLongIterable
-
binarySearch
public int binarySearch(long value)
- Specified by:
binarySearchin interfaceLongList
-
distinct
public MutableLongList distinct()
- Specified by:
distinctin interfaceLongList- Specified by:
distinctin interfaceMutableLongList- Specified by:
distinctin interfaceReversibleLongIterable
-
subList
public MutableLongList subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceLongList- Specified by:
subListin interfaceMutableLongList
-
zipLong
public MutableList<LongLongPair> zipLong(LongIterable iterable)
- Specified by:
zipLongin interfaceLongList- Specified by:
zipLongin interfaceMutableLongList- Since:
- 9.1.
-
newEmpty
public LongArrayList newEmpty()
Creates a new empty LongArrayList.- Specified by:
newEmptyin interfaceMutableLongCollection- Specified by:
newEmptyin interfaceMutableLongList- Since:
- 9.2.
-
zip
public <T> MutableList<LongObjectPair<T>> zip(Iterable<T> iterable)
- Specified by:
zipin interfaceLongList- Specified by:
zipin interfaceMutableLongList- Since:
- 9.1.
-
boxed
public MutableList<Long> boxed()
- Specified by:
boxedin interfaceMutableLongList
-
spliterator
public Spliterator.OfLong spliterator()
- Specified by:
spliteratorin interfaceLongList
-
-