Class IntArrayList
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractIntIterable
org.eclipse.collections.impl.list.mutable.primitive.IntArrayList
- All Implemented Interfaces:
Externalizable,Serializable,MutableIntCollection,IntIterable,IntList,MutableIntList,OrderedIntIterable,ReversibleIntIterable,PrimitiveIterable
IntArrayList is similar to
FastList, and is memory-optimized for int primitives.
This file was automatically generated from template file primitiveArrayList.stg.- Since:
- 3.0.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int newItem) booleanaddAll(int... source) booleanaddAll(IntIterable source) booleanaddAllAtIndex(int index, int... source) booleanaddAllAtIndex(int index, IntIterable source) voidaddAtIndex(int index, int element) booleanallSatisfy(IntPredicate predicate) Returns true if all of the elements in the IntIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(IntPredicate predicate) Returns true if any of the elements in the IntIterable 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(int value) chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableList<V>collect(IntToObjectFunction<? 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(IntToObjectFunction<? extends V> function, R target) Same asIntIterable.collect(IntToObjectFunction), only the results are added to the target Collection.booleancontains(int value) Returns true if the value is contained in the IntIterable, and false if it is not.intcount(IntPredicate predicate) Returns a count of the number of elements in the IntIterable that return true for the specified predicate.intdetectIfNone(IntPredicate predicate, int ifNone) distinct()longdotProduct(IntList list) voideach(IntProcedure procedure) A synonym for forEach.voidensureCapacity(int minCapacity) booleanFollows the same general contract asList.equals(Object).voidforEach(IntProcedure procedure) Applies the IntProcedure to each element in the IntIterable.voidforEachWithIndex(IntIntProcedure procedure) intget(int index) intgetFirst()intgetLast()inthashCode()Follows the same general contract asList.hashCode().intindexOf(int value) <T> TinjectInto(T injectedValue, ObjectIntToObjectFunction<? super T, ? extends T> function) <T> TinjectIntoWithIndex(T injectedValue, ObjectIntIntToObjectFunction<? super T, ? extends T> function) Returns a primitive iterator that can be used to iterate over the IntIterable in an imperative style.intlastIndexOf(int value) intmax()intmin()newEmpty()Creates a new empty IntArrayList.static IntArrayListnewList(IntIterable source) static IntArrayListnewListWith(int... elements) Creates a new list using the passedelementsargument as the backing store.static IntArrayListnewWithNValues(int size, int value) booleannoneSatisfy(IntPredicate predicate) Returns true if none of the elements in the IntIterable return true for the specified predicate, otherwise returns false.voidreject(IntPredicate predicate) Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.<R extends MutableIntCollection>
Rreject(IntPredicate predicate, R target) Same asIntIterable.reject(IntPredicate), only the results are added to the target MutableIntCollection.booleanremove(int value) booleanremoveAll(int... source) booleanremoveAll(IntIterable source) intremoveAtIndex(int index) booleanremoveIf(IntPredicate predicate) booleanretainAll(int... source) booleanretainAll(IntIterable source) select(IntPredicate predicate) Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.<R extends MutableIntCollection>
Rselect(IntPredicate predicate, R target) Same asIntIterable.select(IntPredicate), only the results are added to the target MutableIntCollection.intset(int index, int element) intsize()Returns the number of items in this iterable.sortThis()Sorts this list mutating its contents and returns the same mutable list (this).sortThis(IntComparator comparator) Sorts the internal data structure of this list and returns the list itself as a convenience.subList(int fromIndex, int toIndex) longsum()voidswap(int index1, int index2) int[]toArray()Converts the IntIterable to a primitive int array.int[]toArray(int[] target) Converts the IntIterable to a primitive int array.Returns an immutable copy of this list.voidwith(int element) with(int element1, int element2) with(int element1, int element2, int element3) with(int element1, int element2, int element3, int... elements) withAll(IntIterable elements) without(int element) withoutAll(IntIterable elements) static IntArrayListwrapCopy(int... array) Creates a new list by first copying the array passed in.void<T> MutableList<IntObjectPair<T>>Returns aMutableListformed from thisMutableIntListand aListIterableby combining corresponding elements in pairs.zipInt(IntIterable iterable) Returns aMutableListformed from thisMutableIntListand anotherIntListby combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractIntIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.IntIterable
asLazy, average, averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface org.eclipse.collections.api.list.primitive.IntList
primitiveParallelStream, primitiveStreamMethods inherited from interface org.eclipse.collections.api.list.primitive.MutableIntList
collectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tapMethods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedIntIterable
collectWithIndexMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Constructor Details
-
IntArrayList
public IntArrayList() -
IntArrayList
public IntArrayList(int initialCapacity) -
IntArrayList
public IntArrayList(int... 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 interfaceMutableIntCollection
-
contains
public boolean contains(int value) Description copied from interface:IntIterableReturns true if the value is contained in the IntIterable, and false if it is not.- Specified by:
containsin interfaceIntIterable
-
get
public int get(int index) -
getFirst
public int getFirst()- Specified by:
getFirstin interfaceOrderedIntIterable
-
getLast
public int getLast()- Specified by:
getLastin interfaceReversibleIntIterable
-
indexOf
public int indexOf(int value) - Specified by:
indexOfin interfaceOrderedIntIterable
-
lastIndexOf
public int lastIndexOf(int value) - Specified by:
lastIndexOfin interfaceIntList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(int newItem) - Specified by:
addin interfaceMutableIntCollection
-
addAll
public boolean addAll(int... source) - Specified by:
addAllin interfaceMutableIntCollection
-
addAll
- Specified by:
addAllin interfaceMutableIntCollection
-
addAtIndex
public void addAtIndex(int index, int element) - Specified by:
addAtIndexin interfaceMutableIntList
-
addAllAtIndex
public boolean addAllAtIndex(int index, int... source) - Specified by:
addAllAtIndexin interfaceMutableIntList
-
addAllAtIndex
- Specified by:
addAllAtIndexin interfaceMutableIntList
-
remove
public boolean remove(int value) - Specified by:
removein interfaceMutableIntCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableIntCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableIntCollection
-
removeAll
public boolean removeAll(int... source) - Specified by:
removeAllin interfaceMutableIntCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableIntCollection- See Also:
-
retainAll
public boolean retainAll(int... source) - Specified by:
retainAllin interfaceMutableIntCollection- See Also:
-
removeAtIndex
public int removeAtIndex(int index) - Specified by:
removeAtIndexin interfaceMutableIntList
-
set
public int set(int index, int element) - Specified by:
setin interfaceMutableIntList
-
swap
public void swap(int index1, int index2) - Specified by:
swapin interfaceMutableIntList
-
with
- Specified by:
within interfaceMutableIntCollection- Specified by:
within interfaceMutableIntList
-
without
- Specified by:
withoutin interfaceMutableIntCollection- Specified by:
withoutin interfaceMutableIntList
-
withAll
- Specified by:
withAllin interfaceMutableIntCollection- Specified by:
withAllin interfaceMutableIntList
-
withoutAll
- Specified by:
withoutAllin interfaceMutableIntCollection- Specified by:
withoutAllin interfaceMutableIntList
-
with
-
with
-
with
-
intIterator
Description copied from interface:IntIterableReturns a primitive iterator that can be used to iterate over the IntIterable in an imperative style.- Specified by:
intIteratorin interfaceIntIterable- Specified by:
intIteratorin interfaceMutableIntCollection
-
forEach
Description copied from interface:IntIterableApplies the IntProcedure to each element in the IntIterable.- Specified by:
forEachin interfaceIntIterable
-
each
Description copied from interface:IntIterableA synonym for forEach.- Specified by:
eachin interfaceIntIterable- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceOrderedIntIterable
-
injectInto
- Specified by:
injectIntoin interfaceIntIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectIntIntToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoWithIndexin interfaceOrderedIntIterable- Specified by:
injectIntoWithIndexin interfaceReversibleIntIterable
-
chunk
Description copied from interface:IntIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceIntIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingIntIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:IntIterableReturns a count of the number of elements in the IntIterable that return true for the specified predicate.- Specified by:
countin interfaceIntIterable
-
anySatisfy
Description copied from interface:IntIterableReturns true if any of the elements in the IntIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceIntIterable
-
allSatisfy
Description copied from interface:IntIterableReturns true if all of the elements in the IntIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceIntIterable
-
noneSatisfy
Description copied from interface:IntIterableReturns true if none of the elements in the IntIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceIntIterable
-
select
Description copied from interface:IntIterableReturns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.- Specified by:
selectin interfaceIntIterable- Specified by:
selectin interfaceIntList- Specified by:
selectin interfaceMutableIntCollection- Specified by:
selectin interfaceMutableIntList- Specified by:
selectin interfaceOrderedIntIterable- Specified by:
selectin interfaceReversibleIntIterable
-
select
Description copied from interface:IntIterableSame asIntIterable.select(IntPredicate), only the results are added to the target MutableIntCollection.- Specified by:
selectin interfaceIntIterable- Since:
- 8.1.
-
reject
Description copied from interface:IntIterableReturns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.- Specified by:
rejectin interfaceIntIterable- Specified by:
rejectin interfaceIntList- Specified by:
rejectin interfaceMutableIntCollection- Specified by:
rejectin interfaceMutableIntList- Specified by:
rejectin interfaceOrderedIntIterable- Specified by:
rejectin interfaceReversibleIntIterable
-
reject
Description copied from interface:IntIterableSame asIntIterable.reject(IntPredicate), only the results are added to the target MutableIntCollection.- Specified by:
rejectin interfaceIntIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceIntIterable
-
collect
Description copied from interface:IntIterableReturns 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 interfaceIntIterable- Specified by:
collectin interfaceIntList- Specified by:
collectin interfaceMutableIntCollection- Specified by:
collectin interfaceMutableIntList- Specified by:
collectin interfaceOrderedIntIterable- Specified by:
collectin interfaceReversibleIntIterable
-
collect
Description copied from interface:IntIterableSame asIntIterable.collect(IntToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceIntIterable- Since:
- 8.1.
-
max
public int max()- Specified by:
maxin interfaceIntIterable
-
min
public int min()- Specified by:
minin interfaceIntIterable
-
sum
public long sum()- Specified by:
sumin interfaceIntIterable
-
dotProduct
- Specified by:
dotProductin interfaceIntList
-
toArray
public int[] toArray()Description copied from interface:IntIterableConverts the IntIterable to a primitive int array.- Specified by:
toArrayin interfaceIntIterable
-
toArray
public int[] toArray(int[] target) Description copied from interface:IntIterableConverts the IntIterable to a primitive int 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 interfaceIntIterable
-
equals
Description copied from interface:IntListFollows the same general contract asList.equals(Object). -
hashCode
public int hashCode()Description copied from interface:IntListFollows the same general contract asList.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 interfaceMutableIntCollection- Specified by:
asUnmodifiablein interfaceMutableIntList
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableIntCollection- Specified by:
asSynchronizedin interfaceMutableIntList
-
toImmutable
Description copied from interface:MutableIntListReturns an immutable copy of this list.- Specified by:
toImmutablein interfaceIntList- Specified by:
toImmutablein interfaceMutableIntCollection- Specified by:
toImmutablein interfaceMutableIntList
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
asReversed
- Specified by:
asReversedin interfaceReversibleIntIterable
-
reverseThis
- Specified by:
reverseThisin interfaceMutableIntList
-
sortThis
Description copied from interface:MutableIntListSorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThisin interfaceMutableIntList
-
sortThis
Description copied from interface:MutableIntListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableIntList
-
toReversed
- Specified by:
toReversedin interfaceIntList- Specified by:
toReversedin interfaceMutableIntList- Specified by:
toReversedin interfaceReversibleIntIterable
-
binarySearch
public int binarySearch(int value) - Specified by:
binarySearchin interfaceIntList
-
distinct
- Specified by:
distinctin interfaceIntList- Specified by:
distinctin interfaceMutableIntList- Specified by:
distinctin interfaceReversibleIntIterable
-
subList
- Specified by:
subListin interfaceIntList- Specified by:
subListin interfaceMutableIntList- See Also:
-
zipInt
Description copied from interface:MutableIntListReturns aMutableListformed from thisMutableIntListand anotherIntListby combining corresponding elements in pairs. If one of the twoIntLists is longer than the other, its remaining elements are ignored.- Specified by:
zipIntin interfaceIntList- Specified by:
zipIntin interfaceMutableIntList- Since:
- 9.1.
-
newEmpty
Creates a new empty IntArrayList.- Specified by:
newEmptyin interfaceMutableIntCollection- Specified by:
newEmptyin interfaceMutableIntList- Since:
- 9.2.
-
zip
Description copied from interface:MutableIntListReturns aMutableListformed from thisMutableIntListand 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 interfaceIntList- Specified by:
zipin interfaceMutableIntList- Since:
- 9.1.
-
spliterator
- Specified by:
spliteratorin interfaceIntList
-