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