Class ImmutableShortHashBag
java.lang.Object
org.eclipse.collections.impl.bag.immutable.primitive.ImmutableShortHashBag
- All Implemented Interfaces:
Serializable, ImmutableShortBag, ShortBag, ImmutableShortCollection, PrimitiveIterable, ShortIterable
ImmutableShortHashBag is the non-modifiable equivalent of
ShortHashBag.
This file was automatically generated from template file immutablePrimitiveHashBag.stg.- Since:
- 4.0.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableShortHashBag(short[] newElements) privateImmutableShortHashBag(MutableShortBag delegate) -
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()bottomOccurrences(int count) Returns thecountleast frequently occurring items.private voidcheckOptimizedSize(int length) chunk(int size) Partitions elements in fixed size chunks.<V> ImmutableBag<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.booleancontains(short value) Returns true if the value is contained in the ShortIterable, and false if it is not.booleancontainsAll(short... elements) 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) voideach(ShortProcedure procedure) A synonym for forEach.booleanFollows the same general contract asBag.equals(Object).voidforEachWithOccurrences(ShortIntProcedure shortIntProcedure) For each distinct item, with the number of occurrences, execute the specified procedure.inthashCode()Follows the same general contract asBag.hashCode().<T> TinjectInto(T injectedValue, ObjectShortToObjectFunction<? super T, ? extends T> function) booleanisEmpty()Returns true if this iterable has zero items.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 ImmutableShortHashBagnewBagWith(short... elements) static ImmutableShortHashBagnewBagWith(MutableShortBag elements) newWith(short element) newWithAll(ShortIterable elements) newWithout(short element) newWithoutAll(ShortIterable elements) booleannoneSatisfy(ShortPredicate predicate) Returns true if none of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()intoccurrencesOf(short item) The occurrences of a distinct item in the bag.reject(ShortPredicate predicate) Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.select(ShortPredicate predicate) Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.selectByOccurrences(IntPredicate predicate) Returns all elements of the bag that have a number of occurrences that satisfy the predicate.Returns all elements of the bag that have exactly one occurrence.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.intThe size of the Bag when counting only distinct elements.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 bag.toList()Converts the ShortIterable to a new MutableShortList.topOccurrences(int count) Returns thecountmost frequently occurring items.toSet()Converts the ShortIterable to a new MutableShortSet.short[]toString()Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.private ObjectMethods inherited from interface ImmutableShortBag
selectDuplicates, tapMethods inherited from interface ShortBag
toStringOfItemToCountMethods inherited from interface ShortIterable
averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
delegate
-
-
Constructor Details
-
ImmutableShortHashBag
private ImmutableShortHashBag(short[] newElements) -
ImmutableShortHashBag
-
-
Method Details
-
checkOptimizedSize
private void checkOptimizedSize(int length) -
newBagWith
-
newBagWith
-
newWith
- Specified by:
newWithin interfaceImmutableShortBag- Specified by:
newWithin interfaceImmutableShortCollection
-
newWithout
- Specified by:
newWithoutin interfaceImmutableShortBag- Specified by:
newWithoutin interfaceImmutableShortCollection
-
newWithAll
- Specified by:
newWithAllin interfaceImmutableShortBag- Specified by:
newWithAllin interfaceImmutableShortCollection
-
newWithoutAll
- Specified by:
newWithoutAllin interfaceImmutableShortBag- Specified by:
newWithoutAllin interfaceImmutableShortCollection
-
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
-
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
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
-
containsAll
public boolean containsAll(short... elements) 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
-
each
Description copied from interface:ShortIterableA synonym for forEach.- Specified by:
eachin interfaceShortIterable- Since:
- 7.0.
-
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 interfaceImmutableShortBag- Specified by:
selectin interfaceImmutableShortCollection- Specified by:
selectin interfaceShortBag- Specified by:
selectin interfaceShortIterable
-
selectByOccurrences
Description copied from interface:ImmutableShortBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceImmutableShortBag- Specified by:
selectByOccurrencesin interfaceShortBag
-
selectUnique
Description copied from interface:ImmutableShortBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceImmutableShortBag- Specified by:
selectUniquein interfaceShortBag
-
topOccurrences
Description copied from interface:ImmutableShortBagReturns thecountmost frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.- Specified by:
topOccurrencesin interfaceImmutableShortBag- Specified by:
topOccurrencesin interfaceShortBag
-
bottomOccurrences
Description copied from interface:ImmutableShortBagReturns thecountleast frequently occurring items. In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last item will be returned.- Specified by:
bottomOccurrencesin interfaceImmutableShortBag- Specified by:
bottomOccurrencesin interfaceShortBag
-
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 interfaceImmutableShortBag- Specified by:
rejectin interfaceImmutableShortCollection- Specified by:
rejectin interfaceShortBag- Specified by:
rejectin 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 interfaceImmutableShortBag- Specified by:
collectin interfaceImmutableShortCollection- Specified by:
collectin interfaceShortBag- Specified by:
collectin interfaceShortIterable
-
toList
Description copied from interface:ShortIterableConverts the ShortIterable to a new MutableShortList.- Specified by:
toListin interfaceShortIterable
-
sizeDistinct
public int sizeDistinct()Description copied from interface:ShortBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceShortBag
-
occurrencesOf
public int occurrencesOf(short item) Description copied from interface:ShortBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceShortBag
-
forEachWithOccurrences
Description copied from interface:ShortBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceShortBag
-
detectIfNone
- Specified by:
detectIfNonein interfaceShortIterable
-
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
-
sum
public long sum()- Specified by:
sumin interfaceShortIterable
-
min
public short min()- Specified by:
minin interfaceShortIterable
-
max
public short max()- Specified by:
maxin interfaceShortIterable
-
maxIfEmpty
public short maxIfEmpty(short defaultValue) - Specified by:
maxIfEmptyin 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
-
toSortedList
- Specified by:
toSortedListin interfaceShortIterable
-
noneSatisfy
Description copied from interface:ShortIterableReturns true if none of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin 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
-
injectInto
public <T> T injectInto(T injectedValue, ObjectShortToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceShortIterable
-
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
-
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
-
toImmutable
Description copied from interface:ShortBagReturns an immutable copy of this bag. If the bag is immutable, it returns itself.- Specified by:
toImmutablein interfaceShortBag
-
asLazy
Description copied from interface:ShortIterableReturns a LazyShortIterable adapter wrapping the source ShortIterable.- Specified by:
asLazyin interfaceShortIterable
-
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
-
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
-
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
-
writeReplace
-