Class ImmutableBooleanHashBag
- java.lang.Object
-
- org.eclipse.collections.impl.bag.immutable.primitive.ImmutableBooleanHashBag
-
- All Implemented Interfaces:
java.io.Serializable
,BooleanBag
,ImmutableBooleanBag
,BooleanIterable
,ImmutableBooleanCollection
,PrimitiveIterable
final class ImmutableBooleanHashBag extends java.lang.Object implements ImmutableBooleanBag, java.io.Serializable
ImmutableBooleanHashBag is the non-modifiable equivalent ofBooleanHashBag
. This file was automatically generated from template file immutablePrimitiveHashBag.stg.- Since:
- 4.0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ImmutableBooleanHashBag.ImmutableBooleanBagSerializationProxy
-
Field Summary
Fields Modifier and Type Field Description private MutableBooleanBag
delegate
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableBooleanHashBag(boolean[] newElements)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allSatisfy(BooleanPredicate predicate)
Returns true if all of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(BooleanPredicate predicate)
Returns true if any of the elements in the BooleanIterable 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
.LazyBooleanIterable
asLazy()
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.BooleanIterator
booleanIterator()
Returns a primitive iterator that can be used to iterate over the BooleanIterable in an imperative style.ImmutableList<BooleanIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.private void
checkOptimizedSize(int length)
RichIterable<BooleanIterable>
chunk(int size)
Partitions elements in fixed size chunks.<V> ImmutableBag<V>
collect(BooleanToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.boolean
contains(boolean value)
Returns true if the value is contained in the BooleanIterable, and false if it is not.boolean
containsAll(boolean... elements)
Returns true if all of the values specified in the source array are contained in the BooleanIterable, and false if they are not.boolean
containsAll(BooleanIterable source)
Returns true if all of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.int
count(BooleanPredicate predicate)
Returns a count of the number of elements in the BooleanIterable that return true for the specified predicate.boolean
detectIfNone(BooleanPredicate predicate, boolean ifNone)
void
each(BooleanProcedure procedure)
A synonym for forEach.boolean
equals(java.lang.Object obj)
Follows the same general contract asBag.equals(Object)
.void
forEachWithOccurrences(BooleanIntProcedure booleanIntProcedure)
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, ObjectBooleanToObjectFunction<? 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.static ImmutableBooleanHashBag
newBagWith(boolean... elements)
ImmutableBooleanBag
newWith(boolean element)
ImmutableBooleanBag
newWithAll(BooleanIterable elements)
ImmutableBooleanBag
newWithout(boolean element)
ImmutableBooleanBag
newWithoutAll(BooleanIterable elements)
boolean
noneSatisfy(BooleanPredicate predicate)
Returns true if none of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.boolean
notEmpty()
The English equivalent of !this.isEmpty()int
occurrencesOf(boolean item)
The occurrences of a distinct item in the bag.ImmutableBooleanBag
reject(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.ImmutableBooleanBag
select(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.ImmutableBooleanBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.ImmutableBooleanSet
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.boolean[]
toArray()
Converts the BooleanIterable to a primitive boolean array.boolean[]
toArray(boolean[] target)
Converts the BooleanIterable to a primitive boolean array.MutableBooleanBag
toBag()
Converts the BooleanIterable to a new MutableBooleanBag.ImmutableBooleanBag
toImmutable()
Returns an immutable copy of this bag.MutableBooleanList
toList()
Converts the BooleanIterable to a new MutableBooleanList.ImmutableList<BooleanIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.MutableBooleanSet
toSet()
Converts the BooleanIterable to a new MutableBooleanSet.java.lang.String
toString()
Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.private java.lang.Object
writeReplace()
-
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.BooleanBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.BooleanIterable
collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, reduce, reduceIfEmpty, reject, select
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag
selectDuplicates, tap
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
delegate
private final MutableBooleanBag delegate
-
-
Method Detail
-
checkOptimizedSize
private void checkOptimizedSize(int length)
-
newBagWith
public static ImmutableBooleanHashBag newBagWith(boolean... elements)
-
newWith
public ImmutableBooleanBag newWith(boolean element)
- Specified by:
newWith
in interfaceImmutableBooleanBag
- Specified by:
newWith
in interfaceImmutableBooleanCollection
-
newWithout
public ImmutableBooleanBag newWithout(boolean element)
- Specified by:
newWithout
in interfaceImmutableBooleanBag
- Specified by:
newWithout
in interfaceImmutableBooleanCollection
-
newWithAll
public ImmutableBooleanBag newWithAll(BooleanIterable elements)
- Specified by:
newWithAll
in interfaceImmutableBooleanBag
- Specified by:
newWithAll
in interfaceImmutableBooleanCollection
-
newWithoutAll
public ImmutableBooleanBag newWithoutAll(BooleanIterable elements)
- Specified by:
newWithoutAll
in interfaceImmutableBooleanBag
- Specified by:
newWithoutAll
in interfaceImmutableBooleanCollection
-
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(boolean value)
Description copied from interface:BooleanIterable
Returns true if the value is contained in the BooleanIterable, and false if it is not.- Specified by:
contains
in interfaceBooleanIterable
-
containsAll
public boolean containsAll(BooleanIterable source)
Description copied from interface:BooleanIterable
Returns true if all of the values specified in the source BooleanIterable are contained in the BooleanIterable, and false if they are not.- Specified by:
containsAll
in interfaceBooleanIterable
-
containsAll
public boolean containsAll(boolean... elements)
Description copied from interface:BooleanIterable
Returns true if all of the values specified in the source array are contained in the BooleanIterable, and false if they are not.- Specified by:
containsAll
in interfaceBooleanIterable
-
each
public void each(BooleanProcedure procedure)
Description copied from interface:BooleanIterable
A synonym for forEach.- Specified by:
each
in interfaceBooleanIterable
- Since:
- 7.0.
-
select
public ImmutableBooleanBag select(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.- Specified by:
select
in interfaceBooleanBag
- Specified by:
select
in interfaceBooleanIterable
- Specified by:
select
in interfaceImmutableBooleanBag
- Specified by:
select
in interfaceImmutableBooleanCollection
-
selectByOccurrences
public ImmutableBooleanBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:ImmutableBooleanBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceBooleanBag
- Specified by:
selectByOccurrences
in interfaceImmutableBooleanBag
-
selectUnique
public ImmutableBooleanSet selectUnique()
Description copied from interface:ImmutableBooleanBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceBooleanBag
- Specified by:
selectUnique
in interfaceImmutableBooleanBag
-
topOccurrences
public ImmutableList<BooleanIntPair> topOccurrences(int count)
Description copied from interface:ImmutableBooleanBag
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 interfaceBooleanBag
- Specified by:
topOccurrences
in interfaceImmutableBooleanBag
-
bottomOccurrences
public ImmutableList<BooleanIntPair> bottomOccurrences(int count)
Description copied from interface:ImmutableBooleanBag
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 interfaceBooleanBag
- Specified by:
bottomOccurrences
in interfaceImmutableBooleanBag
-
reject
public ImmutableBooleanBag reject(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.- Specified by:
reject
in interfaceBooleanBag
- Specified by:
reject
in interfaceBooleanIterable
- Specified by:
reject
in interfaceImmutableBooleanBag
- Specified by:
reject
in interfaceImmutableBooleanCollection
-
collect
public <V> ImmutableBag<V> collect(BooleanToObjectFunction<? extends V> function)
Description copied from interface:BooleanIterable
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 interfaceBooleanBag
- Specified by:
collect
in interfaceBooleanIterable
- Specified by:
collect
in interfaceImmutableBooleanBag
- Specified by:
collect
in interfaceImmutableBooleanCollection
-
toList
public MutableBooleanList toList()
Description copied from interface:BooleanIterable
Converts the BooleanIterable to a new MutableBooleanList.- Specified by:
toList
in interfaceBooleanIterable
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:BooleanBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceBooleanBag
-
occurrencesOf
public int occurrencesOf(boolean item)
Description copied from interface:BooleanBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceBooleanBag
-
forEachWithOccurrences
public void forEachWithOccurrences(BooleanIntProcedure booleanIntProcedure)
Description copied from interface:BooleanBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceBooleanBag
-
detectIfNone
public boolean detectIfNone(BooleanPredicate predicate, boolean ifNone)
- Specified by:
detectIfNone
in interfaceBooleanIterable
-
count
public int count(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns a count of the number of elements in the BooleanIterable that return true for the specified predicate.- Specified by:
count
in interfaceBooleanIterable
-
anySatisfy
public boolean anySatisfy(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns true if any of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceBooleanIterable
-
noneSatisfy
public boolean noneSatisfy(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns true if none of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceBooleanIterable
-
allSatisfy
public boolean allSatisfy(BooleanPredicate predicate)
Description copied from interface:BooleanIterable
Returns true if all of the elements in the BooleanIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceBooleanIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectBooleanToObjectFunction<? super T,? extends T> function)
- Specified by:
injectInto
in interfaceBooleanIterable
-
chunk
public RichIterable<BooleanIterable> chunk(int size)
Description copied from interface:BooleanIterable
Partitions elements in fixed size chunks.- Specified by:
chunk
in interfaceBooleanIterable
- Parameters:
size
- the number of elements per chunk- Returns:
- A
RichIterable
containingBooleanIterable
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:BooleanBag
Follows the same general contract asBag.equals(Object)
.- Specified by:
equals
in interfaceBooleanBag
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:BooleanBag
Follows the same general contract asBag.hashCode()
.- Specified by:
hashCode
in interfaceBooleanBag
- Overrides:
hashCode
in classjava.lang.Object
-
toSet
public MutableBooleanSet toSet()
Description copied from interface:BooleanIterable
Converts the BooleanIterable to a new MutableBooleanSet.- Specified by:
toSet
in interfaceBooleanIterable
-
toBag
public MutableBooleanBag toBag()
Description copied from interface:BooleanIterable
Converts the BooleanIterable to a new MutableBooleanBag.- Specified by:
toBag
in interfaceBooleanIterable
-
toImmutable
public ImmutableBooleanBag toImmutable()
Description copied from interface:BooleanBag
Returns an immutable copy of this bag. If the bag is immutable, it returns itself.- Specified by:
toImmutable
in interfaceBooleanBag
-
asLazy
public LazyBooleanIterable asLazy()
Description copied from interface:BooleanIterable
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.- Specified by:
asLazy
in interfaceBooleanIterable
-
toArray
public boolean[] toArray()
Description copied from interface:BooleanIterable
Converts the BooleanIterable to a primitive boolean array.- Specified by:
toArray
in interfaceBooleanIterable
-
toArray
public boolean[] toArray(boolean[] target)
Description copied from interface:BooleanIterable
Converts the BooleanIterable to a primitive boolean 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 interfaceBooleanIterable
-
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
-
booleanIterator
public BooleanIterator booleanIterator()
Description copied from interface:BooleanIterable
Returns a primitive iterator that can be used to iterate over the BooleanIterable in an imperative style.- Specified by:
booleanIterator
in interfaceBooleanIterable
-
writeReplace
private java.lang.Object writeReplace()
-
-