Externalizable
, Serializable
, MutableShortBag
, ShortBag
, MutableShortCollection
, PrimitiveIterable
, ShortIterable
@NotThreadSafe public final class ShortHashBag extends AbstractShortIterable implements MutableShortBag, Externalizable
HashBag
, and is memory-optimized for short primitives.
This file was automatically generated from template file primitiveHashBag.stg.Constructor | Description |
---|---|
ShortHashBag() |
|
ShortHashBag(int size) |
|
ShortHashBag(short... elements) |
|
ShortHashBag(ShortIterable iterable) |
|
ShortHashBag(ShortHashBag bag) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(short item) |
|
boolean |
addAll(short... source) |
|
boolean |
addAll(ShortIterable source) |
|
void |
addOccurrences(short item,
int occurrences) |
|
boolean |
allSatisfy(ShortPredicate predicate) |
Returns true if all of the elements in the ShortIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(ShortPredicate predicate) |
Returns true if any of the elements in the ShortIterable return true for the
specified predicate, otherwise returns false.
|
void |
appendString(Appendable appendable,
String start,
String separator,
String end) |
Prints a string representation of this collection onto the given
Appendable . |
MutableShortBag |
asSynchronized() |
|
MutableShortBag |
asUnmodifiable() |
|
MutableList<ShortIntPair> |
bottomOccurrences(int count) |
Returns the
count least frequently occurring items. |
void |
clear() |
|
<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.
|
boolean |
contains(short value) |
Returns true if the value is contained in the ShortIterable, and false if it is not.
|
int |
count(ShortPredicate predicate) |
Returns a count of the number of elements in the ShortIterable that return true for the
specified predicate.
|
short |
detectIfNone(ShortPredicate predicate,
short ifNone) |
|
void |
each(ShortProcedure procedure) |
A synonym for forEach.
|
boolean |
equals(Object otherBag) |
Follows the same general contract as
Bag.equals(Object) . |
void |
forEach(ShortProcedure procedure) |
Applies the ShortProcedure to each element in the ShortIterable.
|
void |
forEachWithOccurrences(ShortIntProcedure procedure) |
For each distinct item, with the number of occurrences, execute the specified procedure.
|
int |
hashCode() |
Follows the same general contract as
Bag.hashCode() . |
<T> T |
injectInto(T injectedValue,
ObjectShortToObjectFunction<? super T,? extends T> function) |
|
boolean |
isEmpty() |
Returns true if this iterable has zero items.
|
short |
max() |
|
short |
min() |
|
static ShortHashBag |
newBag(int size) |
|
static ShortHashBag |
newBag(ShortBag source) |
|
static ShortHashBag |
newBag(ShortIterable source) |
|
static ShortHashBag |
newBagWith(short... source) |
|
boolean |
noneSatisfy(ShortPredicate predicate) |
Returns true if none of the elements in the ShortIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(short item) |
The occurrences of a distinct item in the bag.
|
void |
readExternal(ObjectInput in) |
|
ShortHashBag |
reject(ShortPredicate predicate) |
Returns a new ShortIterable with all of the elements in the ShortIterable that
return false for the specified predicate.
|
boolean |
remove(short item) |
|
boolean |
removeAll(short... source) |
|
boolean |
removeAll(ShortIterable source) |
|
boolean |
removeOccurrences(short item,
int occurrences) |
|
boolean |
retainAll(short... source) |
|
boolean |
retainAll(ShortIterable source) |
|
ShortHashBag |
select(ShortPredicate predicate) |
Returns a new ShortIterable with all of the elements in the ShortIterable that
return true for the specified predicate.
|
ShortHashBag |
selectByOccurrences(IntPredicate predicate) |
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
|
MutableShortIterator |
shortIterator() |
Returns a primitive iterator that can be used to iterate over the ShortIterable in an
imperative style.
|
int |
size() |
Returns the number of items in this iterable.
|
int |
sizeDistinct() |
The size of the Bag when counting only distinct elements.
|
long |
sum() |
|
short[] |
toArray() |
Converts the ShortIterable to a primitive short array.
|
ImmutableShortBag |
toImmutable() |
Returns an immutable copy of this bag.
|
MutableList<ShortIntPair> |
topOccurrences(int count) |
Returns the
count most frequently occurring items. |
ShortHashBag |
with(short element) |
|
ShortHashBag |
with(short element1,
short element2) |
|
ShortHashBag |
with(short element1,
short element2,
short element3) |
|
ShortHashBag |
withAll(ShortIterable iterable) |
|
ShortHashBag |
without(short element) |
|
ShortHashBag |
withoutAll(ShortIterable iterable) |
|
void |
writeExternal(ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
appendString, appendString, makeString, makeString, makeString, toString
asLazy, average, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, minIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
public ShortHashBag()
public ShortHashBag(int size)
public ShortHashBag(ShortIterable iterable)
public ShortHashBag(short... elements)
public ShortHashBag(ShortHashBag bag)
public static ShortHashBag newBag(int size)
public static ShortHashBag newBagWith(short... source)
public static ShortHashBag newBag(ShortIterable source)
public static ShortHashBag newBag(ShortBag source)
public boolean isEmpty()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public int sizeDistinct()
ShortBag
sizeDistinct
in interface ShortBag
public void clear()
clear
in interface MutableShortCollection
public ShortHashBag with(short element)
with
in interface MutableShortBag
with
in interface MutableShortCollection
public ShortHashBag with(short element1, short element2)
public ShortHashBag with(short element1, short element2, short element3)
public ShortHashBag withAll(ShortIterable iterable)
withAll
in interface MutableShortBag
withAll
in interface MutableShortCollection
public ShortHashBag without(short element)
without
in interface MutableShortBag
without
in interface MutableShortCollection
public ShortHashBag withoutAll(ShortIterable iterable)
withoutAll
in interface MutableShortBag
withoutAll
in interface MutableShortCollection
public boolean contains(short value)
ShortIterable
contains
in interface ShortIterable
public int occurrencesOf(short item)
ShortBag
occurrencesOf
in interface ShortBag
public void forEachWithOccurrences(ShortIntProcedure procedure)
ShortBag
forEachWithOccurrences
in interface ShortBag
public ShortHashBag selectByOccurrences(IntPredicate predicate)
MutableShortBag
selectByOccurrences
in interface MutableShortBag
selectByOccurrences
in interface ShortBag
public MutableList<ShortIntPair> topOccurrences(int count)
MutableShortBag
count
most 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.topOccurrences
in interface MutableShortBag
topOccurrences
in interface ShortBag
public MutableList<ShortIntPair> bottomOccurrences(int count)
MutableShortBag
count
least 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.bottomOccurrences
in interface MutableShortBag
bottomOccurrences
in interface ShortBag
public boolean add(short item)
add
in interface MutableShortCollection
public boolean remove(short item)
remove
in interface MutableShortCollection
public boolean addAll(short... source)
addAll
in interface MutableShortCollection
public boolean addAll(ShortIterable source)
addAll
in interface MutableShortCollection
public boolean removeAll(short... source)
removeAll
in interface MutableShortCollection
public boolean removeAll(ShortIterable source)
removeAll
in interface MutableShortCollection
public boolean retainAll(ShortIterable source)
retainAll
in interface MutableShortCollection
Collection.retainAll(Collection)
public boolean retainAll(short... source)
retainAll
in interface MutableShortCollection
Collection.retainAll(Collection)
public void addOccurrences(short item, int occurrences)
addOccurrences
in interface MutableShortBag
public boolean removeOccurrences(short item, int occurrences)
removeOccurrences
in interface MutableShortBag
public void forEach(ShortProcedure procedure)
ShortIterable
forEach
in interface ShortIterable
public void each(ShortProcedure procedure)
ShortIterable
each
in interface ShortIterable
public ShortHashBag select(ShortPredicate predicate)
ShortIterable
select
in interface MutableShortBag
select
in interface MutableShortCollection
select
in interface ShortBag
select
in interface ShortIterable
public ShortHashBag reject(ShortPredicate predicate)
ShortIterable
reject
in interface MutableShortBag
reject
in interface MutableShortCollection
reject
in interface ShortBag
reject
in interface ShortIterable
public <T> T injectInto(T injectedValue, ObjectShortToObjectFunction<? super T,? extends T> function)
injectInto
in interface ShortIterable
public boolean equals(Object otherBag)
ShortBag
Bag.equals(Object)
.public int hashCode()
ShortBag
Bag.hashCode()
.public void appendString(Appendable appendable, String start, String separator, String end)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String, String, String)
.appendString
in interface PrimitiveIterable
public int count(ShortPredicate predicate)
ShortIterable
count
in interface ShortIterable
public boolean anySatisfy(ShortPredicate predicate)
ShortIterable
anySatisfy
in interface ShortIterable
public boolean allSatisfy(ShortPredicate predicate)
ShortIterable
allSatisfy
in interface ShortIterable
public boolean noneSatisfy(ShortPredicate predicate)
ShortIterable
noneSatisfy
in interface ShortIterable
public short detectIfNone(ShortPredicate predicate, short ifNone)
detectIfNone
in interface ShortIterable
public <V> MutableBag<V> collect(ShortToObjectFunction<? extends V> function)
ShortIterable
collect
in interface MutableShortBag
collect
in interface MutableShortCollection
collect
in interface ShortBag
collect
in interface ShortIterable
public short max()
max
in interface ShortIterable
public short min()
min
in interface ShortIterable
public long sum()
sum
in interface ShortIterable
public short[] toArray()
ShortIterable
toArray
in interface ShortIterable
public MutableShortBag asUnmodifiable()
asUnmodifiable
in interface MutableShortBag
asUnmodifiable
in interface MutableShortCollection
public MutableShortBag asSynchronized()
asSynchronized
in interface MutableShortBag
asSynchronized
in interface MutableShortCollection
public ImmutableShortBag toImmutable()
MutableShortBag
toImmutable
in interface MutableShortBag
toImmutable
in interface MutableShortCollection
toImmutable
in interface ShortBag
public MutableShortIterator shortIterator()
ShortIterable
shortIterator
in interface MutableShortCollection
shortIterator
in interface ShortIterable
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
Copyright © 2004–2017. All rights reserved.