Class ByteHashBag
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractByteIterable
org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag
- All Implemented Interfaces:
Externalizable,Serializable,ByteBag,MutableByteBag,ByteIterable,MutableByteCollection,PrimitiveIterable
public class ByteHashBag extends AbstractByteIterable implements MutableByteBag, Externalizable
ByteHashBag is similar to
HashBag, and is memory-optimized for byte primitives.
This file was automatically generated from template file primitiveHashBag.stg.- Since:
- 3.0.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ByteHashBag()ByteHashBag(byte... elements)ByteHashBag(int size)ByteHashBag(ByteIterable iterable)ByteHashBag(ByteHashBag bag) -
Method Summary
Modifier and Type Method Description booleanadd(byte item)booleanaddAll(byte... source)booleanaddAll(ByteIterable source)voidaddOccurrences(byte item, int occurrences)booleanallSatisfy(BytePredicate predicate)Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(BytePredicate predicate)Returns true if any of the elements in the ByteIterable 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.MutableByteBagasSynchronized()MutableByteBagasUnmodifiable()MutableList<ByteIntPair>bottomOccurrences(int count)Returns thecountleast frequently occurring items.MutableByteIteratorbyteIterator()Returns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.RichIterable<ByteIterable>chunk(int size)Partitions elements in fixed size chunks.voidclear()<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.booleancontains(byte value)Returns true if the value is contained in the ByteIterable, and false if it is not.intcount(BytePredicate predicate)Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.bytedetectIfNone(BytePredicate predicate, byte ifNone)voideach(ByteProcedure procedure)A synonym for forEach.booleanequals(Object otherBag)Follows the same general contract asBag.equals(Object).voidforEach(ByteProcedure procedure)Applies the ByteProcedure to each element in the ByteIterable.voidforEachWithOccurrences(ByteIntProcedure 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, ObjectByteToObjectFunction<? super T,? extends T> function)booleanisEmpty()Returns true if this iterable has zero items.bytemax()bytemin()static ByteHashBagnewBag(int size)static ByteHashBagnewBag(ByteBag source)static ByteHashBagnewBag(ByteIterable source)static ByteHashBagnewBagWith(byte... source)ByteHashBagnewEmpty()Creates a new empty ByteHashBag.booleannoneSatisfy(BytePredicate predicate)Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()intoccurrencesOf(byte item)The occurrences of a distinct item in the bag.voidreadExternal(ObjectInput in)ByteHashBagreject(BytePredicate predicate)Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.booleanremove(byte item)booleanremoveAll(byte... source)booleanremoveAll(ByteIterable source)booleanremoveIf(BytePredicate predicate)booleanremoveOccurrences(byte item, int occurrences)booleanretainAll(byte... source)booleanretainAll(ByteIterable source)ByteHashBagselect(BytePredicate predicate)Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.ByteHashBagselectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableByteSetselectUnique()Returns all elements of the bag that have exactly one occurrence.intsize()Returns the number of items in this iterable.intsizeDistinct()The size of the Bag when counting only distinct elements.longsum()byte[]toArray()Converts the ByteIterable to a primitive byte array.byte[]toArray(byte[] array)Converts the ByteIterable to a primitive byte array.ImmutableByteBagtoImmutable()Returns an immutable copy of this bag.MutableList<ByteIntPair>topOccurrences(int count)Returns thecountmost frequently occurring items.ByteHashBagwith(byte element)ByteHashBagwith(byte element1, byte element2)ByteHashBagwith(byte element1, byte element2, byte element3)ByteHashBagwithAll(ByteIterable iterable)ByteHashBagwithout(byte element)ByteHashBagwithoutAll(ByteIterable iterable)voidwriteExternal(ObjectOutput out)Methods inherited from class org.eclipse.collections.impl.primitive.AbstractByteIterable
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface org.eclipse.collections.api.bag.primitive.ByteBag
toStringOfItemToCountMethods inherited from interface org.eclipse.collections.api.ByteIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedListMethods inherited from interface org.eclipse.collections.api.bag.primitive.MutableByteBag
selectDuplicates, tapMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, makeString, makeString, makeString, toString
-
Constructor Details
-
ByteHashBag
public ByteHashBag() -
ByteHashBag
public ByteHashBag(int size) -
ByteHashBag
-
ByteHashBag
public ByteHashBag(byte... elements) -
ByteHashBag
-
-
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:ByteBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceByteBag
-
clear
public void clear()- Specified by:
clearin interfaceMutableByteCollection
-
with
- Specified by:
within interfaceMutableByteBag- Specified by:
within interfaceMutableByteCollection
-
with
-
with
-
withAll
- Specified by:
withAllin interfaceMutableByteBag- Specified by:
withAllin interfaceMutableByteCollection
-
without
- Specified by:
withoutin interfaceMutableByteBag- Specified by:
withoutin interfaceMutableByteCollection
-
withoutAll
- Specified by:
withoutAllin interfaceMutableByteBag- Specified by:
withoutAllin interfaceMutableByteCollection
-
contains
public boolean contains(byte value)Description copied from interface:ByteIterableReturns true if the value is contained in the ByteIterable, and false if it is not.- Specified by:
containsin interfaceByteIterable
-
occurrencesOf
public int occurrencesOf(byte item)Description copied from interface:ByteBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceByteBag
-
forEachWithOccurrences
Description copied from interface:ByteBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceByteBag
-
selectByOccurrences
Description copied from interface:MutableByteBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceByteBag- Specified by:
selectByOccurrencesin interfaceMutableByteBag
-
selectUnique
Description copied from interface:MutableByteBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceByteBag- Specified by:
selectUniquein interfaceMutableByteBag
-
topOccurrences
Description copied from interface:MutableByteBagReturns 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 interfaceByteBag- Specified by:
topOccurrencesin interfaceMutableByteBag
-
bottomOccurrences
Description copied from interface:MutableByteBagReturns 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 interfaceByteBag- Specified by:
bottomOccurrencesin interfaceMutableByteBag
-
add
public boolean add(byte item)- Specified by:
addin interfaceMutableByteCollection
-
remove
public boolean remove(byte item)- Specified by:
removein interfaceMutableByteCollection
-
removeIf
- Specified by:
removeIfin interfaceMutableByteCollection
-
addAll
public boolean addAll(byte... source)- Specified by:
addAllin interfaceMutableByteCollection
-
addAll
- Specified by:
addAllin interfaceMutableByteCollection
-
removeAll
public boolean removeAll(byte... source)- Specified by:
removeAllin interfaceMutableByteCollection
-
removeAll
- Specified by:
removeAllin interfaceMutableByteCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableByteCollection- See Also:
Collection.retainAll(Collection)
-
retainAll
public boolean retainAll(byte... source)- Specified by:
retainAllin interfaceMutableByteCollection- See Also:
Collection.retainAll(Collection)
-
addOccurrences
public void addOccurrences(byte item, int occurrences)- Specified by:
addOccurrencesin interfaceMutableByteBag
-
removeOccurrences
public boolean removeOccurrences(byte item, int occurrences)- Specified by:
removeOccurrencesin interfaceMutableByteBag
-
forEach
Description copied from interface:ByteIterableApplies the ByteProcedure to each element in the ByteIterable.- Specified by:
forEachin interfaceByteIterable
-
each
Description copied from interface:ByteIterableA synonym for forEach.- Specified by:
eachin interfaceByteIterable- Since:
- 7.0.
-
select
Description copied from interface:ByteIterableReturns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.- Specified by:
selectin interfaceByteBag- Specified by:
selectin interfaceByteIterable- Specified by:
selectin interfaceMutableByteBag- Specified by:
selectin interfaceMutableByteCollection
-
reject
Description copied from interface:ByteIterableReturns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.- Specified by:
rejectin interfaceByteBag- Specified by:
rejectin interfaceByteIterable- Specified by:
rejectin interfaceMutableByteBag- Specified by:
rejectin interfaceMutableByteCollection
-
injectInto
public <T> T injectInto(T injectedValue, ObjectByteToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceByteIterable
-
chunk
Description copied from interface:ByteIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceByteIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingByteIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
equals
Description copied from interface:ByteBagFollows the same general contract asBag.equals(Object). -
hashCode
public int hashCode()Description copied from interface:ByteBagFollows 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:ByteIterableReturns a count of the number of elements in the ByteIterable that return true for the specified predicate.- Specified by:
countin interfaceByteIterable
-
anySatisfy
Description copied from interface:ByteIterableReturns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceByteIterable
-
allSatisfy
Description copied from interface:ByteIterableReturns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceByteIterable
-
noneSatisfy
Description copied from interface:ByteIterableReturns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceByteIterable
-
detectIfNone
- Specified by:
detectIfNonein interfaceByteIterable
-
collect
Description copied from interface:ByteIterableReturns 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 interfaceByteBag- Specified by:
collectin interfaceByteIterable- Specified by:
collectin interfaceMutableByteBag- Specified by:
collectin interfaceMutableByteCollection
-
max
public byte max()- Specified by:
maxin interfaceByteIterable
-
min
public byte min()- Specified by:
minin interfaceByteIterable
-
sum
public long sum()- Specified by:
sumin interfaceByteIterable
-
toArray
public byte[] toArray()Description copied from interface:ByteIterableConverts the ByteIterable to a primitive byte array.- Specified by:
toArrayin interfaceByteIterable
-
toArray
public byte[] toArray(byte[] array)Description copied from interface:ByteIterableConverts the ByteIterable to a primitive byte 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 interfaceByteIterable
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableByteBag- Specified by:
asUnmodifiablein interfaceMutableByteCollection
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableByteBag- Specified by:
asSynchronizedin interfaceMutableByteCollection
-
toImmutable
Description copied from interface:MutableByteBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceByteBag- Specified by:
toImmutablein interfaceMutableByteBag- Specified by:
toImmutablein interfaceMutableByteCollection
-
newEmpty
Creates a new empty ByteHashBag.- Specified by:
newEmptyin interfaceMutableByteBag- Specified by:
newEmptyin interfaceMutableByteCollection- Since:
- 9.2.
-
byteIterator
Description copied from interface:ByteIterableReturns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.- Specified by:
byteIteratorin interfaceByteIterable- Specified by:
byteIteratorin interfaceMutableByteCollection
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-