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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ShortArrayList()ShortArrayList(int initialCapacity)ShortArrayList(short... array)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(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)booleananySatisfy(ShortPredicate predicate)voidappendString(Appendable appendable, String start, String separator, String end)LazyShortIterableasReversed()MutableShortListasSynchronized()MutableShortListasUnmodifiable()intbinarySearch(short value)MutableList<Short>boxed()RichIterable<ShortIterable>chunk(int size)voidclear()<V> MutableList<V>collect(ShortToObjectFunction<? extends V> function)<V,R extends Collection<V>>
Rcollect(ShortToObjectFunction<? extends V> function, R target)booleancontains(short value)intcount(ShortPredicate predicate)shortdetectIfNone(ShortPredicate predicate, short ifNone)MutableShortListdistinct()longdotProduct(ShortList list)voideach(ShortProcedure procedure)voidensureCapacity(int minCapacity)booleanequals(Object otherList)voidforEachWithIndex(ShortIntProcedure procedure)shortget(int index)shortgetFirst()shortgetLast()inthashCode()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()ShortArrayListnewEmpty()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)voidreadExternal(ObjectInput in)ShortArrayListreject(ShortPredicate predicate)<R extends MutableShortCollection>
Rreject(ShortPredicate predicate, R target)booleanremove(short value)booleanremoveAll(short... source)booleanremoveAll(ShortIterable source)shortremoveAtIndex(int index)booleanremoveIf(ShortPredicate predicate)booleanretainAll(short... source)booleanretainAll(ShortIterable source)ShortArrayListreverseThis()ShortArrayListselect(ShortPredicate predicate)<R extends MutableShortCollection>
Rselect(ShortPredicate predicate, R target)shortset(int index, short element)MutableShortIteratorshortIterator()intsize()ShortArrayListsortThis()ShortArrayListsortThis(ShortComparator comparator)MutableShortListsubList(int fromIndex, int toIndex)longsum()voidswap(int index1, int index2)short[]toArray()short[]toArray(short[] target)ImmutableShortListtoImmutable()ShortArrayListtoReversed()voidtrimToSize()ShortArrayListwith(short element)ShortArrayListwith(short element1, short element2)ShortArrayListwith(short element1, short element2, short element3)ShortArrayListwith(short element1, short element2, short element3, short... elements)ShortArrayListwithAll(ShortIterable elements)ShortArrayListwithout(short element)ShortArrayListwithoutAll(ShortIterable elements)static ShortArrayListwrapCopy(short... array)Creates a new list by first copying the array passed in.voidwriteExternal(ObjectOutput out)<T> MutableList<ShortObjectPair<T>>zip(Iterable<T> iterable)MutableList<ShortShortPair>zipShort(ShortIterable iterable)-
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractShortIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.MutableShortList
collectWithIndex, rejectWithIndex, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisBy, tap
-
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedShortIterable
collectWithIndex, rejectWithIndex, selectWithIndex
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Methods 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, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.list.primitive.ShortList
forEachInBoth
-
-
-
-
Method Detail
-
newListWith
public static ShortArrayList newListWith(short... 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 ShortArrayList newList(ShortIterable source)
-
newWithNValues
public static ShortArrayList newWithNValues(int size, short value)
-
wrapCopy
public static ShortArrayList wrapCopy(short... 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 interfaceMutableShortCollection
-
contains
public boolean contains(short value)
- Specified by:
containsin interfaceShortIterable
-
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
public boolean addAll(ShortIterable source)
- 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
public boolean addAllAtIndex(int index, ShortIterable source)- Specified by:
addAllAtIndexin interfaceMutableShortList
-
remove
public boolean remove(short value)
- Specified by:
removein interfaceMutableShortCollection
-
removeIf
public boolean removeIf(ShortPredicate predicate)
- Specified by:
removeIfin interfaceMutableShortCollection
-
removeAll
public boolean removeAll(ShortIterable source)
- Specified by:
removeAllin interfaceMutableShortCollection
-
removeAll
public boolean removeAll(short... source)
- Specified by:
removeAllin interfaceMutableShortCollection
-
retainAll
public boolean retainAll(ShortIterable source)
- Specified by:
retainAllin interfaceMutableShortCollection
-
retainAll
public boolean retainAll(short... source)
- Specified by:
retainAllin interfaceMutableShortCollection
-
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
public ShortArrayList with(short element)
- Specified by:
within interfaceMutableShortCollection- Specified by:
within interfaceMutableShortList
-
without
public ShortArrayList without(short element)
- Specified by:
withoutin interfaceMutableShortCollection- Specified by:
withoutin interfaceMutableShortList
-
withAll
public ShortArrayList withAll(ShortIterable elements)
- Specified by:
withAllin interfaceMutableShortCollection- Specified by:
withAllin interfaceMutableShortList
-
withoutAll
public ShortArrayList withoutAll(ShortIterable elements)
- Specified by:
withoutAllin interfaceMutableShortCollection- Specified by:
withoutAllin interfaceMutableShortList
-
with
public ShortArrayList with(short element1, short element2)
-
with
public ShortArrayList with(short element1, short element2, short element3)
-
with
public ShortArrayList with(short element1, short element2, short element3, short... elements)
-
shortIterator
public MutableShortIterator shortIterator()
- Specified by:
shortIteratorin interfaceMutableShortCollection- Specified by:
shortIteratorin interfaceShortIterable
-
each
public void each(ShortProcedure procedure)
- Specified by:
eachin interfaceShortIterable- Since:
- 7.0.
-
forEachWithIndex
public void forEachWithIndex(ShortIntProcedure procedure)
- 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
public RichIterable<ShortIterable> chunk(int size)
- Specified by:
chunkin interfaceShortIterable
-
count
public int count(ShortPredicate predicate)
- Specified by:
countin interfaceShortIterable
-
anySatisfy
public boolean anySatisfy(ShortPredicate predicate)
- Specified by:
anySatisfyin interfaceShortIterable
-
allSatisfy
public boolean allSatisfy(ShortPredicate predicate)
- Specified by:
allSatisfyin interfaceShortIterable
-
select
public ShortArrayList select(ShortPredicate 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
public <R extends MutableShortCollection> R select(ShortPredicate predicate, R target)
- Specified by:
selectin interfaceShortIterable- Since:
- 8.1.
-
reject
public ShortArrayList reject(ShortPredicate 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
public <R extends MutableShortCollection> R reject(ShortPredicate predicate, R target)
- Specified by:
rejectin interfaceShortIterable- Since:
- 8.1.
-
detectIfNone
public short detectIfNone(ShortPredicate predicate, short ifNone)
- Specified by:
detectIfNonein interfaceShortIterable
-
collect
public <V> MutableList<V> collect(ShortToObjectFunction<? extends V> function)
- 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)
- 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
public long dotProduct(ShortList list)
- Specified by:
dotProductin interfaceShortList
-
toArray
public short[] toArray()
- Specified by:
toArrayin interfaceShortIterable
-
toArray
public short[] toArray(short[] target)
- Specified by:
toArrayin interfaceShortIterable
-
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 MutableShortList asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableShortCollection- Specified by:
asUnmodifiablein interfaceMutableShortList
-
asSynchronized
public MutableShortList asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableShortCollection- Specified by:
asSynchronizedin interfaceMutableShortList
-
toImmutable
public ImmutableShortList toImmutable()
- Specified by:
toImmutablein interfaceMutableShortCollection- Specified by:
toImmutablein interfaceMutableShortList- Specified by:
toImmutablein interfaceShortList
-
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 LazyShortIterable asReversed()
- Specified by:
asReversedin interfaceReversibleShortIterable
-
reverseThis
public ShortArrayList reverseThis()
- Specified by:
reverseThisin interfaceMutableShortList
-
sortThis
public ShortArrayList sortThis()
- Specified by:
sortThisin interfaceMutableShortList
-
sortThis
public ShortArrayList sortThis(ShortComparator comparator)
- Specified by:
sortThisin interfaceMutableShortList
-
toReversed
public ShortArrayList toReversed()
- Specified by:
toReversedin interfaceMutableShortList- Specified by:
toReversedin interfaceReversibleShortIterable- Specified by:
toReversedin interfaceShortList
-
binarySearch
public int binarySearch(short value)
- Specified by:
binarySearchin interfaceShortList
-
distinct
public MutableShortList distinct()
- Specified by:
distinctin interfaceMutableShortList- Specified by:
distinctin interfaceReversibleShortIterable- Specified by:
distinctin interfaceShortList
-
subList
public MutableShortList subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceMutableShortList- Specified by:
subListin interfaceShortList
-
zipShort
public MutableList<ShortShortPair> zipShort(ShortIterable iterable)
- Specified by:
zipShortin interfaceMutableShortList- Specified by:
zipShortin interfaceShortList- Since:
- 9.1.
-
newEmpty
public ShortArrayList newEmpty()
Creates a new empty ShortArrayList.- Specified by:
newEmptyin interfaceMutableShortCollection- Specified by:
newEmptyin interfaceMutableShortList- Since:
- 9.2.
-
zip
public <T> MutableList<ShortObjectPair<T>> zip(Iterable<T> iterable)
- Specified by:
zipin interfaceMutableShortList- Specified by:
zipin interfaceShortList- Since:
- 9.1.
-
boxed
public MutableList<Short> boxed()
- Specified by:
boxedin interfaceMutableShortList
-
-