Class ImmutableByteEmptyBag
- java.lang.Object
-
- org.eclipse.collections.impl.bag.immutable.primitive.ImmutableByteEmptyBag
-
- All Implemented Interfaces:
java.io.Serializable
,ByteBag
,ImmutableByteBag
,ByteIterable
,ImmutableByteCollection
,PrimitiveIterable
final class ImmutableByteEmptyBag extends java.lang.Object implements ImmutableByteBag, java.io.Serializable
ImmutableByteEmptyBag is an optimization forImmutableByteBag
of size 0. This file was automatically generated from template file immutablePrimitiveEmptyBag.stg.- Since:
- 4.0.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ImmutableByteBag
INSTANCE
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ImmutableByteEmptyBag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Prints a string representation of this collection onto the givenAppendable
.void
appendString(java.lang.Appendable appendable, java.lang.String separator)
Prints a string representation of this collection onto the givenAppendable
.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 givenAppendable
.LazyByteIterable
asLazy()
Returns a LazyByteIterable adapter wrapping the source ByteIterable.double
average()
ImmutableList<ByteIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.ByteIterator
byteIterator()
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.<V> ImmutableBag<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.boolean
containsAll(byte... elements)
Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.boolean
containsAll(ByteIterable source)
Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are 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 obj)
Follows the same general contract asBag.equals(Object)
.void
forEach(ByteProcedure procedure)
Applies the ByteProcedure to each element in the ByteIterable.void
forEachWithOccurrences(ByteIntProcedure byteIntProcedure)
For each distinct item, with the number of occurrences, execute the specified procedure.int
hashCode()
Follows the same general contract asBag.hashCode()
.<T> T
injectInto(T injectedValue, ObjectByteToObjectFunction<? super T,? extends T> function)
boolean
isEmpty()
Returns true if this iterable has zero items.java.lang.String
makeString()
Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)
and defaulting the separator parameter to the characters", "
(comma and space).java.lang.String
makeString(java.lang.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).java.lang.String
makeString(java.lang.String start, java.lang.String separator, java.lang.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.byte
max()
byte
maxIfEmpty(byte defaultValue)
double
median()
byte
min()
byte
minIfEmpty(byte defaultValue)
ImmutableByteBag
newWith(byte element)
ImmutableByteBag
newWithAll(ByteIterable elements)
ImmutableByteBag
newWithout(byte element)
ImmutableByteBag
newWithoutAll(ByteIterable elements)
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.private java.lang.Object
readResolve()
ImmutableByteBag
reject(BytePredicate predicate)
Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.ImmutableByteBag
select(BytePredicate predicate)
Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.ImmutableByteBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.ImmutableByteSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.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.byte[]
toArray(byte[] target)
Converts the ByteIterable to a primitive byte array.MutableByteBag
toBag()
Converts the ByteIterable to a new MutableByteBag.ImmutableByteBag
toImmutable()
Returns an immutable copy of this bag.MutableByteList
toList()
Converts the ByteIterable to a new MutableByteList.ImmutableList<ByteIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.MutableByteSet
toSet()
Converts the ByteIterable to a new MutableByteSet.byte[]
toSortedArray()
MutableByteList
toSortedList()
java.lang.String
toString()
Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ByteBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.ByteIterable
averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ImmutableByteBag
selectDuplicates, tap
-
-
-
-
Field Detail
-
INSTANCE
static final ImmutableByteBag INSTANCE
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
readResolve
private java.lang.Object readResolve()
-
newWith
public ImmutableByteBag newWith(byte element)
- Specified by:
newWith
in interfaceImmutableByteBag
- Specified by:
newWith
in interfaceImmutableByteCollection
-
newWithout
public ImmutableByteBag newWithout(byte element)
- Specified by:
newWithout
in interfaceImmutableByteBag
- Specified by:
newWithout
in interfaceImmutableByteCollection
-
newWithAll
public ImmutableByteBag newWithAll(ByteIterable elements)
- Specified by:
newWithAll
in interfaceImmutableByteBag
- Specified by:
newWithAll
in interfaceImmutableByteCollection
-
newWithoutAll
public ImmutableByteBag newWithoutAll(ByteIterable elements)
- Specified by:
newWithoutAll
in interfaceImmutableByteBag
- Specified by:
newWithoutAll
in interfaceImmutableByteCollection
-
size
public int size()
Description copied from interface:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
isEmpty
public boolean isEmpty()
Description copied from interface:PrimitiveIterable
Returns true if this iterable has zero items.- Specified by:
isEmpty
in interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()
Description copied from interface:PrimitiveIterable
The English equivalent of !this.isEmpty()- Specified by:
notEmpty
in interfacePrimitiveIterable
-
contains
public boolean contains(byte value)
Description copied from interface:ByteIterable
Returns true if the value is contained in the ByteIterable, and false if it is not.- Specified by:
contains
in interfaceByteIterable
-
containsAll
public boolean containsAll(ByteIterable source)
Description copied from interface:ByteIterable
Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.- Specified by:
containsAll
in interfaceByteIterable
-
containsAll
public boolean containsAll(byte... elements)
Description copied from interface:ByteIterable
Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.- Specified by:
containsAll
in interfaceByteIterable
-
forEach
public void forEach(ByteProcedure procedure)
Description copied from interface:ByteIterable
Applies the ByteProcedure to each element in the ByteIterable.- Specified by:
forEach
in interfaceByteIterable
-
each
public void each(ByteProcedure procedure)
Description copied from interface:ByteIterable
A synonym for forEach.- Specified by:
each
in interfaceByteIterable
- Since:
- 7.0.
-
select
public ImmutableByteBag select(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.- Specified by:
select
in interfaceByteBag
- Specified by:
select
in interfaceByteIterable
- Specified by:
select
in interfaceImmutableByteBag
- Specified by:
select
in interfaceImmutableByteCollection
-
selectUnique
public ImmutableByteSet selectUnique()
Description copied from interface:ImmutableByteBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceByteBag
- Specified by:
selectUnique
in interfaceImmutableByteBag
-
reject
public ImmutableByteBag reject(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.- Specified by:
reject
in interfaceByteBag
- Specified by:
reject
in interfaceByteIterable
- Specified by:
reject
in interfaceImmutableByteBag
- Specified by:
reject
in interfaceImmutableByteCollection
-
collect
public <V> ImmutableBag<V> collect(ByteToObjectFunction<? extends V> function)
Description copied from interface:ByteIterable
Returns 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:
collect
in interfaceByteBag
- Specified by:
collect
in interfaceByteIterable
- Specified by:
collect
in interfaceImmutableByteBag
- Specified by:
collect
in interfaceImmutableByteCollection
-
toList
public MutableByteList toList()
Description copied from interface:ByteIterable
Converts the ByteIterable to a new MutableByteList.- Specified by:
toList
in interfaceByteIterable
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:ByteBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceByteBag
-
occurrencesOf
public int occurrencesOf(byte item)
Description copied from interface:ByteBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceByteBag
-
forEachWithOccurrences
public void forEachWithOccurrences(ByteIntProcedure byteIntProcedure)
Description copied from interface:ByteBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceByteBag
-
selectByOccurrences
public ImmutableByteBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:ImmutableByteBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceByteBag
- Specified by:
selectByOccurrences
in interfaceImmutableByteBag
-
topOccurrences
public ImmutableList<ByteIntPair> topOccurrences(int count)
Description copied from interface:ImmutableByteBag
Returns thecount
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.- Specified by:
topOccurrences
in interfaceByteBag
- Specified by:
topOccurrences
in interfaceImmutableByteBag
-
bottomOccurrences
public ImmutableList<ByteIntPair> bottomOccurrences(int count)
Description copied from interface:ImmutableByteBag
Returns thecount
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.- Specified by:
bottomOccurrences
in interfaceByteBag
- Specified by:
bottomOccurrences
in interfaceImmutableByteBag
-
detectIfNone
public byte detectIfNone(BytePredicate predicate, byte ifNone)
- Specified by:
detectIfNone
in interfaceByteIterable
-
count
public int count(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.- Specified by:
count
in interfaceByteIterable
-
anySatisfy
public boolean anySatisfy(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceByteIterable
-
sum
public long sum()
- Specified by:
sum
in interfaceByteIterable
-
min
public byte min()
- Specified by:
min
in interfaceByteIterable
-
max
public byte max()
- Specified by:
max
in interfaceByteIterable
-
maxIfEmpty
public byte maxIfEmpty(byte defaultValue)
- Specified by:
maxIfEmpty
in interfaceByteIterable
-
minIfEmpty
public byte minIfEmpty(byte defaultValue)
- Specified by:
minIfEmpty
in interfaceByteIterable
-
average
public double average()
- Specified by:
average
in interfaceByteIterable
-
median
public double median()
- Specified by:
median
in interfaceByteIterable
-
toSortedArray
public byte[] toSortedArray()
- Specified by:
toSortedArray
in interfaceByteIterable
-
toSortedList
public MutableByteList toSortedList()
- Specified by:
toSortedList
in interfaceByteIterable
-
noneSatisfy
public boolean noneSatisfy(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceByteIterable
-
allSatisfy
public boolean allSatisfy(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceByteIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectByteToObjectFunction<? super T,? extends T> function)
- Specified by:
injectInto
in interfaceByteIterable
-
chunk
public RichIterable<ByteIterable> chunk(int size)
Description copied from interface:ByteIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceByteIterable
- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingByteIterable
s of sizesize
, except the last will be truncated if the elements don't divide evenly.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:ByteBag
Follows the same general contract asBag.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:ByteBag
Follows the same general contract asBag.hashCode()
.
-
toSet
public MutableByteSet toSet()
Description copied from interface:ByteIterable
Converts the ByteIterable to a new MutableByteSet.- Specified by:
toSet
in interfaceByteIterable
-
toBag
public MutableByteBag toBag()
Description copied from interface:ByteIterable
Converts the ByteIterable to a new MutableByteBag.- Specified by:
toBag
in interfaceByteIterable
-
toImmutable
public ImmutableByteBag toImmutable()
Description copied from interface:ByteBag
Returns an immutable copy of this bag. If the bag is immutable, it returns itself.- Specified by:
toImmutable
in interfaceByteBag
-
asLazy
public LazyByteIterable asLazy()
Description copied from interface:ByteIterable
Returns a LazyByteIterable adapter wrapping the source ByteIterable.- Specified by:
asLazy
in interfaceByteIterable
-
toArray
public byte[] toArray()
Description copied from interface:ByteIterable
Converts the ByteIterable to a primitive byte array.- Specified by:
toArray
in interfaceByteIterable
-
toArray
public byte[] toArray(byte[] target)
Description copied from interface:ByteIterable
Converts 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:
toArray
in interfaceByteIterable
-
toString
public java.lang.String toString()
Description copied from interface:PrimitiveIterable
Returns 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:
toString
in interfacePrimitiveIterable
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this PrimitiveIterable
- See Also:
AbstractCollection.toString()
-
makeString
public java.lang.String makeString()
Description copied from interface:PrimitiveIterable
Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)
and defaulting the separator parameter to the characters", "
(comma and space).- Specified by:
makeString
in interfacePrimitiveIterable
- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String separator)
Description copied from interface:PrimitiveIterable
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).- Specified by:
makeString
in interfacePrimitiveIterable
- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String start, java.lang.String separator, java.lang.String end)
Description copied from interface:PrimitiveIterable
Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.- Specified by:
makeString
in interfacePrimitiveIterable
- Returns:
- a string representation of this collection.
-
appendString
public void appendString(java.lang.Appendable appendable)
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString()
.- Specified by:
appendString
in interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String separator)
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
byteIterator
public ByteIterator byteIterator()
Description copied from interface:ByteIterable
Returns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.- Specified by:
byteIterator
in interfaceByteIterable
-
-