Class ShortHashBag
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractShortIterable
org.eclipse.collections.impl.bag.mutable.primitive.ShortHashBag
- All Implemented Interfaces:
Externalizable,Serializable,MutableShortBag,ShortBag,MutableShortCollection,PrimitiveIterable,ShortIterable
ShortHashBag is similar to
HashBag, and is memory-optimized for short primitives.
This file was automatically generated from template file primitiveHashBag.stg.- Since:
- 3.0.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionShortHashBag(int size) ShortHashBag(short... elements) ShortHashBag(ShortIterable iterable) ShortHashBag(ShortHashBag bag) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(short item) booleanaddAll(short... source) booleanaddAll(ShortIterable source) voidaddOccurrences(short item, int occurrences) 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.bottomOccurrences(int count) Returns thecountleast frequently occurring items.chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableBag<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.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 procedure) 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.shortmax()shortmin()static ShortHashBagnewBag(int size) static ShortHashBagstatic ShortHashBagnewBag(ShortIterable source) static ShortHashBagnewBagWith(short... source) newEmpty()Creates a new empty ShortHashBag.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.voidreject(ShortPredicate predicate) Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.booleanremove(short item) booleanremoveAll(short... source) booleanremoveAll(ShortIterable source) booleanremoveIf(ShortPredicate predicate) booleanremoveOccurrences(short item, int occurrences) 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.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[] array) Converts the ShortIterable to a primitive short array.Returns an immutable copy of this bag.topOccurrences(int count) Returns thecountmost frequently occurring items.with(short element) with(short element1, short element2) with(short element1, short element2, short element3) withAll(ShortIterable iterable) without(short element) withoutAll(ShortIterable iterable) voidMethods 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.bag.primitive.MutableShortBag
selectDuplicates, tapMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, toStringMethods inherited from interface org.eclipse.collections.api.bag.primitive.ShortBag
toStringOfItemToCountMethods inherited from interface org.eclipse.collections.api.ShortIterable
asLazy, average, averageIfEmpty, collect, 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, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Constructor Details
-
ShortHashBag
public ShortHashBag() -
ShortHashBag
public ShortHashBag(int size) -
ShortHashBag
-
ShortHashBag
public ShortHashBag(short... elements) -
ShortHashBag
-
-
Method Details
-
newBag
-
newBagWith
-
newBag
-
newBag
-
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
-
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
sizeDistinct
public int sizeDistinct()Description copied from interface:ShortBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceShortBag
-
clear
public void clear()- Specified by:
clearin interfaceMutableShortCollection
-
with
- Specified by:
within interfaceMutableShortBag- Specified by:
within interfaceMutableShortCollection
-
with
-
with
-
withAll
- Specified by:
withAllin interfaceMutableShortBag- Specified by:
withAllin interfaceMutableShortCollection
-
without
- Specified by:
withoutin interfaceMutableShortBag- Specified by:
withoutin interfaceMutableShortCollection
-
withoutAll
- Specified by:
withoutAllin interfaceMutableShortBag- Specified by:
withoutAllin 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
-
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
-
selectByOccurrences
Description copied from interface:MutableShortBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceMutableShortBag- Specified by:
selectByOccurrencesin interfaceShortBag
-
selectUnique
Description copied from interface:MutableShortBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceMutableShortBag- Specified by:
selectUniquein interfaceShortBag
-
topOccurrences
Description copied from interface:MutableShortBagReturns 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 interfaceMutableShortBag- Specified by:
topOccurrencesin interfaceShortBag
-
bottomOccurrences
Description copied from interface:MutableShortBagReturns 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 interfaceMutableShortBag- Specified by:
bottomOccurrencesin interfaceShortBag
-
add
public boolean add(short item) - Specified by:
addin interfaceMutableShortCollection
-
remove
public boolean remove(short item) - Specified by:
removein interfaceMutableShortCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableShortCollection
-
addAll
public boolean addAll(short... source) - Specified by:
addAllin interfaceMutableShortCollection
-
addAll
- Specified by:
addAllin interfaceMutableShortCollection
-
removeAll
public boolean removeAll(short... source) - Specified by:
removeAllin interfaceMutableShortCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableShortCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableShortCollection- See Also:
-
retainAll
public boolean retainAll(short... source) - Specified by:
retainAllin interfaceMutableShortCollection- See Also:
-
addOccurrences
public void addOccurrences(short item, int occurrences) - Specified by:
addOccurrencesin interfaceMutableShortBag
-
removeOccurrences
public boolean removeOccurrences(short item, int occurrences) - Specified by:
removeOccurrencesin interfaceMutableShortBag
-
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 interfaceMutableShortBag- Specified by:
selectin interfaceMutableShortCollection- Specified by:
selectin interfaceShortBag- Specified by:
selectin interfaceShortIterable
-
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 interfaceMutableShortBag- Specified by:
rejectin interfaceMutableShortCollection- Specified by:
rejectin interfaceShortBag- Specified by:
rejectin 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
Description copied from interface:ShortBagFollows the same general contract asBag.equals(Object). -
hashCode
public int hashCode()Description copied from interface:ShortBagFollows the same general contract asBag.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
-
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
-
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
-
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 interfaceMutableShortBag- Specified by:
collectin interfaceMutableShortCollection- Specified by:
collectin interfaceShortBag- Specified by:
collectin interfaceShortIterable
-
max
public short max()- Specified by:
maxin interfaceShortIterable
-
min
public short min()- Specified by:
minin interfaceShortIterable
-
sum
public long sum()- Specified by:
sumin 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[] array) 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
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableShortBag- Specified by:
asUnmodifiablein interfaceMutableShortCollection
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableShortBag- Specified by:
asSynchronizedin interfaceMutableShortCollection
-
toImmutable
Description copied from interface:MutableShortBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceMutableShortBag- Specified by:
toImmutablein interfaceMutableShortCollection- Specified by:
toImmutablein interfaceShortBag
-
newEmpty
Creates a new empty ShortHashBag.- Specified by:
newEmptyin interfaceMutableShortBag- Specified by:
newEmptyin interfaceMutableShortCollection- Since:
- 9.2.
-
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
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-