Class ShortArrayList
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractShortIterable
org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList
- All Implemented Interfaces:
Externalizable,Serializable,MutableShortCollection,MutableShortList,ShortList,OrderedShortIterable,ReversibleShortIterable,PrimitiveIterable,ShortIterable
public class ShortArrayList
extends AbstractShortIterable
implements MutableShortList, Externalizable
ShortArrayList is similar to FastList, and is memory-optimized for short primitives.
This file was automatically generated from template file primitiveArrayList.stg.
- Since:
- 3.0.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(short newItem) booleanaddAll(short... source) booleanaddAll(ShortIterable source) booleanaddAllAtIndex(int index, short... source) booleanaddAllAtIndex(int index, ShortIterable source) voidaddAtIndex(int index, short element) booleanallSatisfy(ShortPredicate predicate) Returns true if all of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(ShortPredicate predicate) Returns true if any of the elements in the ShortIterable 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(short value) chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableList<V>collect(ShortToObjectFunction<? 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(ShortToObjectFunction<? extends V> function, R target) Same asShortIterable.collect(ShortToObjectFunction), only the results are added to the target Collection.booleancontains(short value) Returns true if the value is contained in the ShortIterable, and false if it is not.intcount(ShortPredicate predicate) Returns a count of the number of elements in the ShortIterable that return true for the specified predicate.shortdetectIfNone(ShortPredicate predicate, short ifNone) distinct()longdotProduct(ShortList list) voideach(ShortProcedure procedure) A synonym for forEach.voidensureCapacity(int minCapacity) booleanFollows the same general contract asList.equals(Object).voidforEachWithIndex(ShortIntProcedure procedure) shortget(int index) shortgetFirst()shortgetLast()inthashCode()Follows the same general contract asList.hashCode().intindexOf(short value) <T> TinjectInto(T injectedValue, ObjectShortToObjectFunction<? super T, ? extends T> function) <T> TinjectIntoWithIndex(T injectedValue, ObjectShortIntToObjectFunction<? super T, ? extends T> function) intlastIndexOf(short value) shortmax()shortmin()newEmpty()Creates a new empty ShortArrayList.static ShortArrayListnewList(ShortIterable source) static ShortArrayListnewListWith(short... elements) Creates a new list using the passedelementsargument as the backing store.static ShortArrayListnewWithNValues(int size, short value) voidreject(ShortPredicate predicate) Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.<R extends MutableShortCollection>
Rreject(ShortPredicate predicate, R target) Same asShortIterable.reject(ShortPredicate), only the results are added to the target MutableShortCollection.booleanremove(short value) booleanremoveAll(short... source) booleanremoveAll(ShortIterable source) shortremoveAtIndex(int index) booleanremoveIf(ShortPredicate predicate) booleanretainAll(short... source) booleanretainAll(ShortIterable source) select(ShortPredicate predicate) Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.<R extends MutableShortCollection>
Rselect(ShortPredicate predicate, R target) Same asShortIterable.select(ShortPredicate), only the results are added to the target MutableShortCollection.shortset(int index, short element) Returns a primitive iterator that can be used to iterate over the ShortIterable in an imperative style.intsize()Returns the number of items in this iterable.sortThis()Sorts this list mutating its contents and returns the same mutable list (this).sortThis(ShortComparator 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) short[]toArray()Converts the ShortIterable to a primitive short array.short[]toArray(short[] target) Converts the ShortIterable to a primitive short array.Returns an immutable copy of this list.voidwith(short element) with(short element1, short element2) with(short element1, short element2, short element3) with(short element1, short element2, short element3, short... elements) withAll(ShortIterable elements) without(short element) withoutAll(ShortIterable elements) static ShortArrayListwrapCopy(short... array) Creates a new list by first copying the array passed in.void<T> MutableList<ShortObjectPair<T>>Returns aMutableListformed from thisMutableShortListand aListIterableby combining corresponding elements in pairs.zipShort(ShortIterable iterable) Returns aMutableListformed from thisMutableShortListand anotherShortListby combining corresponding elements in pairs.Methods inherited from class org.eclipse.collections.impl.primitive.AbstractShortIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.list.primitive.MutableShortList
collectWithIndex, rejectWithIndex, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tapMethods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedShortIterable
collectWithIndex, rejectWithIndex, selectWithIndexMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toStringMethods inherited from interface org.eclipse.collections.api.ShortIterable
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 org.eclipse.collections.api.list.primitive.ShortList
forEachInBoth
-
Constructor Details
-
ShortArrayList
public ShortArrayList() -
ShortArrayList
public ShortArrayList(int initialCapacity) -
ShortArrayList
public ShortArrayList(short... 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 interfaceMutableShortCollection
-
contains
public boolean contains(short value) Description copied from interface:ShortIterableReturns true if the value is contained in the ShortIterable, and false if it is not.- Specified by:
containsin interfaceShortIterable
-
get
public short get(int index) -
getFirst
public short getFirst()- Specified by:
getFirstin interfaceOrderedShortIterable
-
getLast
public short getLast()- Specified by:
getLastin interfaceReversibleShortIterable
-
indexOf
public int indexOf(short value) - Specified by:
indexOfin interfaceOrderedShortIterable
-
lastIndexOf
public int lastIndexOf(short value) - Specified by:
lastIndexOfin interfaceShortList
-
trimToSize
public void trimToSize() -
ensureCapacity
public void ensureCapacity(int minCapacity) -
add
public boolean add(short newItem) - Specified by:
addin interfaceMutableShortCollection
-
addAll
public boolean addAll(short... source) - Specified by:
addAllin interfaceMutableShortCollection
-
addAll
- Specified by:
addAllin interfaceMutableShortCollection
-
addAtIndex
public void addAtIndex(int index, short element) - Specified by:
addAtIndexin interfaceMutableShortList
-
addAllAtIndex
public boolean addAllAtIndex(int index, short... source) - Specified by:
addAllAtIndexin interfaceMutableShortList
-
addAllAtIndex
- Specified by:
addAllAtIndexin interfaceMutableShortList
-
remove
public boolean remove(short value) - Specified by:
removein interfaceMutableShortCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableShortCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableShortCollection
-
removeAll
public boolean removeAll(short... source) - Specified by:
removeAllin interfaceMutableShortCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableShortCollection- See Also:
-
retainAll
public boolean retainAll(short... source) - Specified by:
retainAllin interfaceMutableShortCollection- See Also:
-
removeAtIndex
public short removeAtIndex(int index) - Specified by:
removeAtIndexin interfaceMutableShortList
-
set
public short set(int index, short element) - Specified by:
setin interfaceMutableShortList
-
swap
public void swap(int index1, int index2) - Specified by:
swapin interfaceMutableShortList
-
with
- Specified by:
within interfaceMutableShortCollection- Specified by:
within interfaceMutableShortList
-
without
- Specified by:
withoutin interfaceMutableShortCollection- Specified by:
withoutin interfaceMutableShortList
-
withAll
- Specified by:
withAllin interfaceMutableShortCollection- Specified by:
withAllin interfaceMutableShortList
-
withoutAll
- Specified by:
withoutAllin interfaceMutableShortCollection- Specified by:
withoutAllin interfaceMutableShortList
-
with
-
with
-
with
-
shortIterator
Description copied from interface:ShortIterableReturns a primitive iterator that can be used to iterate over the ShortIterable in an imperative style.- Specified by:
shortIteratorin interfaceMutableShortCollection- Specified by:
shortIteratorin interfaceShortIterable
-
each
Description copied from interface:ShortIterableA synonym for forEach.- Specified by:
eachin interfaceShortIterable- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceOrderedShortIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectShortToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceShortIterable
-
injectIntoWithIndex
public <T> T injectIntoWithIndex(T injectedValue, ObjectShortIntToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoWithIndexin interfaceOrderedShortIterable- Specified by:
injectIntoWithIndexin interfaceReversibleShortIterable
-
chunk
Description copied from interface:ShortIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceShortIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingShortIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
count
Description copied from interface:ShortIterableReturns a count of the number of elements in the ShortIterable that return true for the specified predicate.- Specified by:
countin interfaceShortIterable
-
anySatisfy
Description copied from interface:ShortIterableReturns true if any of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceShortIterable
-
allSatisfy
Description copied from interface:ShortIterableReturns true if all of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceShortIterable
-
select
Description copied from interface:ShortIterableReturns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.- Specified by:
selectin interfaceMutableShortCollection- Specified by:
selectin interfaceMutableShortList- Specified by:
selectin interfaceOrderedShortIterable- Specified by:
selectin interfaceReversibleShortIterable- Specified by:
selectin interfaceShortIterable- Specified by:
selectin interfaceShortList
-
select
Description copied from interface:ShortIterableSame asShortIterable.select(ShortPredicate), only the results are added to the target MutableShortCollection.- Specified by:
selectin interfaceShortIterable- Since:
- 8.1.
-
reject
Description copied from interface:ShortIterableReturns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.- Specified by:
rejectin interfaceMutableShortCollection- Specified by:
rejectin interfaceMutableShortList- Specified by:
rejectin interfaceOrderedShortIterable- Specified by:
rejectin interfaceReversibleShortIterable- Specified by:
rejectin interfaceShortIterable- Specified by:
rejectin interfaceShortList
-
reject
Description copied from interface:ShortIterableSame asShortIterable.reject(ShortPredicate), only the results are added to the target MutableShortCollection.- Specified by:
rejectin interfaceShortIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceShortIterable
-
collect
Description copied from interface:ShortIterableReturns 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 interfaceMutableShortCollection- Specified by:
collectin interfaceMutableShortList- Specified by:
collectin interfaceOrderedShortIterable- Specified by:
collectin interfaceReversibleShortIterable- Specified by:
collectin interfaceShortIterable- Specified by:
collectin interfaceShortList
-
collect
public <V,R extends Collection<V>> R collect(ShortToObjectFunction<? extends V> function, R target) Description copied from interface:ShortIterableSame asShortIterable.collect(ShortToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceShortIterable- Since:
- 8.1.
-
max
public short max()- Specified by:
maxin interfaceShortIterable
-
min
public short min()- Specified by:
minin interfaceShortIterable
-
sum
public long sum()- Specified by:
sumin interfaceShortIterable
-
dotProduct
- Specified by:
dotProductin interfaceShortList
-
toArray
public short[] toArray()Description copied from interface:ShortIterableConverts the ShortIterable to a primitive short array.- Specified by:
toArrayin interfaceShortIterable
-
toArray
public short[] toArray(short[] target) Description copied from interface:ShortIterableConverts the ShortIterable to a primitive short 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 interfaceShortIterable
-
equals
Description copied from interface:ShortListFollows the same general contract asList.equals(Object). -
hashCode
public int hashCode()Description copied from interface:ShortListFollows 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 interfaceMutableShortCollection- Specified by:
asUnmodifiablein interfaceMutableShortList
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableShortCollection- Specified by:
asSynchronizedin interfaceMutableShortList
-
toImmutable
Description copied from interface:MutableShortListReturns an immutable copy of this list.- Specified by:
toImmutablein interfaceMutableShortCollection- Specified by:
toImmutablein interfaceMutableShortList- Specified by:
toImmutablein interfaceShortList
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
asReversed
- Specified by:
asReversedin interfaceReversibleShortIterable
-
reverseThis
- Specified by:
reverseThisin interfaceMutableShortList
-
sortThis
Description copied from interface:MutableShortListSorts this list mutating its contents and returns the same mutable list (this).- Specified by:
sortThisin interfaceMutableShortList
-
sortThis
Description copied from interface:MutableShortListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableShortList
-
toReversed
- Specified by:
toReversedin interfaceMutableShortList- Specified by:
toReversedin interfaceReversibleShortIterable- Specified by:
toReversedin interfaceShortList
-
binarySearch
public int binarySearch(short value) - Specified by:
binarySearchin interfaceShortList
-
distinct
- Specified by:
distinctin interfaceMutableShortList- Specified by:
distinctin interfaceReversibleShortIterable- Specified by:
distinctin interfaceShortList
-
subList
- Specified by:
subListin interfaceMutableShortList- Specified by:
subListin interfaceShortList- See Also:
-
zipShort
Description copied from interface:MutableShortListReturns aMutableListformed from thisMutableShortListand anotherShortListby combining corresponding elements in pairs. If one of the twoShortLists is longer than the other, its remaining elements are ignored.- Specified by:
zipShortin interfaceMutableShortList- Specified by:
zipShortin interfaceShortList- Since:
- 9.1.
-
newEmpty
Creates a new empty ShortArrayList.- Specified by:
newEmptyin interfaceMutableShortCollection- Specified by:
newEmptyin interfaceMutableShortList- Since:
- 9.2.
-
zip
Description copied from interface:MutableShortListReturns aMutableListformed from thisMutableShortListand 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 interfaceMutableShortList- Specified by:
zipin interfaceShortList- Since:
- 9.1.
-