Class ImmutableShortArrayList
java.lang.Object
org.eclipse.collections.impl.list.immutable.primitive.ImmutableShortArrayList
- All Implemented Interfaces:
Serializable, ImmutableShortCollection, ImmutableShortList, ShortList, OrderedShortIterable, ReversibleShortIterable, PrimitiveIterable, ShortIterable
ImmutableShortArrayList is the non-modifiable equivalent of
ShortArrayList.
It wraps a Java short array.
This file was automatically generated from template file immutablePrimitiveArrayList.stg.- Since:
- 3.2.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final short[]private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallSatisfy(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) Prints a string representation of this collection onto the givenAppendable.voidappendString(Appendable appendable, String separator) Prints a string representation of this collection onto the givenAppendable.voidappendString(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable.asLazy()Returns a LazyShortIterable adapter wrapping the source ShortIterable.doubleaverage()intbinarySearch(short value) chunk(int size) Partitions elements in fixed size chunks.<V> ImmutableList<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.booleancontainsAll(short... source) Returns true if all of the values specified in the source array are contained in the ShortIterable, and false if they are not.booleancontainsAll(ShortIterable source) Returns true if all of the values specified in the source ShortIterable are contained in the ShortIterable, and false if they are 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.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) booleanisEmpty()Returns true if this iterable has zero items.intlastIndexOf(short value) Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).makeString(String separator) Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).makeString(String start, String separator, String end) Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.shortmax()shortmaxIfEmpty(short defaultValue) doublemedian()shortmin()shortminIfEmpty(short defaultValue) static ImmutableShortArrayListnewList(ShortIterable iterable) static ImmutableShortArrayListnewListWith(short... elements) newWith(short element) newWithAll(ShortIterable elements) newWithout(short element) newWithoutAll(ShortIterable elements) booleannotEmpty()The English equivalent of !this.isEmpty()reject(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.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.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.subList(int fromIndex, int toIndex) longsum()short[]toArray()Converts the ShortIterable to a primitive short array.short[]toArray(short[] target) Converts the ShortIterable to a primitive short array.toBag()Converts the ShortIterable to a new MutableShortBag.Returns an immutable copy of this list.toList()Converts the ShortIterable to a new MutableShortList.toSet()Converts the ShortIterable to a new MutableShortSet.short[]toStack()Converts the collection to a ShortStack.toString()Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.<T> ImmutableList<ShortObjectPair<T>> Returns anImmutableListformed from thisImmutableShortListand aListIterableby combining corresponding elements in pairs.zipShort(ShortIterable iterable) Returns anImmutableListformed from thisImmutableShortListand anotherShortListby combining corresponding elements in pairs.Methods inherited from interface ImmutableShortList
collectWithIndex, rejectWithIndex, selectWithIndex, tapMethods inherited from interface OrderedShortIterable
collectWithIndex, rejectWithIndex, selectWithIndexMethods inherited from interface ShortIterable
averageIfEmpty, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, noneSatisfy, reduce, reduceIfEmpty, summaryStatistics, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface ShortList
forEachInBoth
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
items
private final short[] items
-
-
Constructor Details
-
ImmutableShortArrayList
private ImmutableShortArrayList(short[] newElements)
-
-
Method Details
-
newList
-
newListWith
-
get
-
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
-
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 interfaceShortIterable
-
each
Description copied from interface:ShortIterableA synonym for forEach.- Specified by:
eachin interfaceShortIterable- Since:
- 7.0.
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceOrderedShortIterable
-
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 interfaceImmutableShortCollection- Specified by:
selectin interfaceImmutableShortList- 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 interfaceImmutableShortCollection- Specified by:
rejectin interfaceImmutableShortList- 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 interfaceImmutableShortCollection- Specified by:
collectin interfaceImmutableShortList- 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.
-
sum
public long sum()- Specified by:
sumin interfaceShortIterable
-
max
public short max()- Specified by:
maxin interfaceShortIterable
-
maxIfEmpty
public short maxIfEmpty(short defaultValue) - Specified by:
maxIfEmptyin interfaceShortIterable
-
min
public short min()- Specified by:
minin interfaceShortIterable
-
minIfEmpty
public short minIfEmpty(short defaultValue) - Specified by:
minIfEmptyin interfaceShortIterable
-
average
public double average()- Specified by:
averagein interfaceShortIterable
-
median
public double median()- Specified by:
medianin interfaceShortIterable
-
toSortedArray
public short[] toSortedArray()- Specified by:
toSortedArrayin interfaceShortIterable
-
dotProduct
- Specified by:
dotProductin interfaceShortList
-
asReversed
- Specified by:
asReversedin interfaceReversibleShortIterable
-
toSortedList
- Specified by:
toSortedListin interfaceShortIterable
-
binarySearch
public int binarySearch(short value) - Specified by:
binarySearchin 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
-
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
-
containsAll
public boolean containsAll(short... source) Description copied from interface:ShortIterableReturns true if all of the values specified in the source array are contained in the ShortIterable, and false if they are not.- Specified by:
containsAllin interfaceShortIterable
-
containsAll
Description copied from interface:ShortIterableReturns true if all of the values specified in the source ShortIterable are contained in the ShortIterable, and false if they are not.- Specified by:
containsAllin interfaceShortIterable
-
toList
Description copied from interface:ShortIterableConverts the ShortIterable to a new MutableShortList.- Specified by:
toListin interfaceShortIterable
-
toSet
Description copied from interface:ShortIterableConverts the ShortIterable to a new MutableShortSet.- Specified by:
toSetin interfaceShortIterable
-
toBag
Description copied from interface:ShortIterableConverts the ShortIterable to a new MutableShortBag.- Specified by:
toBagin interfaceShortIterable
-
asLazy
Description copied from interface:ShortIterableReturns a LazyShortIterable adapter wrapping the source ShortIterable.- Specified by:
asLazyin interfaceShortIterable
-
toImmutable
Description copied from interface:ShortListReturns an immutable copy of this list. If the list is immutable, it returns itself.- Specified by:
toImmutablein interfaceShortList
-
toReversed
- Specified by:
toReversedin interfaceImmutableShortList- Specified by:
toReversedin interfaceReversibleShortIterable- Specified by:
toReversedin interfaceShortList
-
newWith
- Specified by:
newWithin interfaceImmutableShortCollection- Specified by:
newWithin interfaceImmutableShortList
-
newWithout
- Specified by:
newWithoutin interfaceImmutableShortCollection- Specified by:
newWithoutin interfaceImmutableShortList
-
newWithAll
- Specified by:
newWithAllin interfaceImmutableShortCollection- Specified by:
newWithAllin interfaceImmutableShortList
-
newWithoutAll
- Specified by:
newWithoutAllin interfaceImmutableShortCollection- Specified by:
newWithoutAllin interfaceImmutableShortList
-
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
isEmpty
public boolean isEmpty()Description copied from interface:PrimitiveIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()Description copied from interface:PrimitiveIterableThe English equivalent of !this.isEmpty()- Specified by:
notEmptyin interfacePrimitiveIterable
-
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.
-
equals
-
hashCode
-
toString
Description copied from interface:PrimitiveIterableReturns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", IntLists.mutable.empty().toString()); Assert.assertEquals("[1]", IntLists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", IntLists.mutable.with(1, 2, 3).toString());- Specified by:
toStringin interfacePrimitiveIterable- Overrides:
toStringin classObject- Returns:
- a string representation of this PrimitiveIterable
- See Also:
-
makeString
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
Description copied from interface:PrimitiveIterableReturns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString().- Specified by:
appendStringin interfacePrimitiveIterable
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String).- Specified by:
appendStringin interfacePrimitiveIterable
-
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
-
distinct
- Specified by:
distinctin interfaceImmutableShortList- Specified by:
distinctin interfaceReversibleShortIterable- Specified by:
distinctin interfaceShortList- Since:
- 6.0.
-
subList
- Specified by:
subListin interfaceImmutableShortList- Specified by:
subListin interfaceShortList- See Also:
-
zipShort
Description copied from interface:ImmutableShortListReturns anImmutableListformed from thisImmutableShortListand anotherShortListby combining corresponding elements in pairs. If one of the twoShortLists is longer than the other, its remaining elements are ignored.- Specified by:
zipShortin interfaceImmutableShortList- Specified by:
zipShortin interfaceShortList- Since:
- 9.1.
-
zip
Description copied from interface:ImmutableShortListReturns anImmutableListformed from thisImmutableShortListand 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 interfaceImmutableShortList- Specified by:
zipin interfaceShortList- Since:
- 9.1.
-
toStack
Description copied from interface:OrderedShortIterableConverts the collection to a ShortStack.- Specified by:
toStackin interfaceOrderedShortIterable
-