Class BooleanHashBag
- java.lang.Object
-
- org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag
-
- All Implemented Interfaces:
Externalizable
,Serializable
,BooleanBag
,MutableBooleanBag
,BooleanIterable
,MutableBooleanCollection
,PrimitiveIterable
public final class BooleanHashBag extends Object implements MutableBooleanBag, Externalizable
BooleanHashBag is similar toHashBag
, and is memory-optimized for boolean primitives.- Since:
- 3.0.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BooleanHashBag()
BooleanHashBag(boolean... elements)
BooleanHashBag(BooleanIterable iterable)
BooleanHashBag(BooleanHashBag bag)
-
Method Summary
-
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.MutableBooleanBag
newEmpty, selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableBooleanCollection
removeIf
-
-
-
-
Constructor Detail
-
BooleanHashBag
public BooleanHashBag()
-
BooleanHashBag
public BooleanHashBag(BooleanIterable iterable)
-
BooleanHashBag
public BooleanHashBag(boolean... elements)
-
BooleanHashBag
public BooleanHashBag(BooleanHashBag bag)
-
-
Method Detail
-
newBagWith
public static BooleanHashBag newBagWith(boolean... source)
-
newBag
public static BooleanHashBag newBag(BooleanIterable source)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()
- Specified by:
notEmpty
in interfacePrimitiveIterable
-
size
public int size()
- Specified by:
size
in interfacePrimitiveIterable
-
sizeDistinct
public int sizeDistinct()
- Specified by:
sizeDistinct
in interfaceBooleanBag
-
clear
public void clear()
- Specified by:
clear
in interfaceMutableBooleanCollection
-
with
public BooleanHashBag with(boolean element)
- Specified by:
with
in interfaceMutableBooleanBag
- Specified by:
with
in interfaceMutableBooleanCollection
-
with
public BooleanHashBag with(boolean element1, boolean element2)
-
with
public BooleanHashBag with(boolean element1, boolean element2, boolean element3)
-
withAll
public BooleanHashBag withAll(BooleanIterable iterable)
- Specified by:
withAll
in interfaceMutableBooleanBag
- Specified by:
withAll
in interfaceMutableBooleanCollection
-
without
public BooleanHashBag without(boolean element)
- Specified by:
without
in interfaceMutableBooleanBag
- Specified by:
without
in interfaceMutableBooleanCollection
-
withoutAll
public BooleanHashBag withoutAll(BooleanIterable iterable)
- Specified by:
withoutAll
in interfaceMutableBooleanBag
- Specified by:
withoutAll
in interfaceMutableBooleanCollection
-
asUnmodifiable
public MutableBooleanBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableBooleanBag
- Specified by:
asUnmodifiable
in interfaceMutableBooleanCollection
-
asSynchronized
public MutableBooleanBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableBooleanBag
- Specified by:
asSynchronized
in interfaceMutableBooleanCollection
-
toImmutable
public ImmutableBooleanBag toImmutable()
- Specified by:
toImmutable
in interfaceBooleanBag
- Specified by:
toImmutable
in interfaceMutableBooleanBag
- Specified by:
toImmutable
in interfaceMutableBooleanCollection
-
contains
public boolean contains(boolean value)
- Specified by:
contains
in interfaceBooleanIterable
-
containsAll
public boolean containsAll(boolean... source)
- Specified by:
containsAll
in interfaceBooleanIterable
-
containsAll
public boolean containsAll(BooleanIterable source)
- Specified by:
containsAll
in interfaceBooleanIterable
-
occurrencesOf
public int occurrencesOf(boolean item)
- Specified by:
occurrencesOf
in interfaceBooleanBag
-
forEachWithOccurrences
public void forEachWithOccurrences(BooleanIntProcedure procedure)
- Specified by:
forEachWithOccurrences
in interfaceBooleanBag
-
add
public boolean add(boolean item)
- Specified by:
add
in interfaceMutableBooleanCollection
-
remove
public boolean remove(boolean item)
- Specified by:
remove
in interfaceMutableBooleanCollection
-
addAll
public boolean addAll(boolean... source)
- Specified by:
addAll
in interfaceMutableBooleanCollection
-
addAll
public boolean addAll(BooleanIterable source)
- Specified by:
addAll
in interfaceMutableBooleanCollection
-
removeAll
public boolean removeAll(boolean... source)
- Specified by:
removeAll
in interfaceMutableBooleanCollection
-
removeAll
public boolean removeAll(BooleanIterable source)
- Specified by:
removeAll
in interfaceMutableBooleanCollection
-
retainAll
public boolean retainAll(BooleanIterable elements)
- Specified by:
retainAll
in interfaceMutableBooleanCollection
-
retainAll
public boolean retainAll(boolean... source)
- Specified by:
retainAll
in interfaceMutableBooleanCollection
-
addOccurrences
public void addOccurrences(boolean item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableBooleanBag
-
removeOccurrences
public boolean removeOccurrences(boolean item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableBooleanBag
-
each
public void each(BooleanProcedure procedure)
- Specified by:
each
in interfaceBooleanIterable
- Since:
- 7.0.
-
select
public MutableBooleanBag select(BooleanPredicate predicate)
- Specified by:
select
in interfaceBooleanBag
- Specified by:
select
in interfaceBooleanIterable
- Specified by:
select
in interfaceMutableBooleanBag
- Specified by:
select
in interfaceMutableBooleanCollection
-
selectByOccurrences
public MutableBooleanBag selectByOccurrences(IntPredicate predicate)
- Specified by:
selectByOccurrences
in interfaceBooleanBag
- Specified by:
selectByOccurrences
in interfaceMutableBooleanBag
-
topOccurrences
public MutableList<BooleanIntPair> topOccurrences(int count)
- Specified by:
topOccurrences
in interfaceBooleanBag
- Specified by:
topOccurrences
in interfaceMutableBooleanBag
-
bottomOccurrences
public MutableList<BooleanIntPair> bottomOccurrences(int count)
- Specified by:
bottomOccurrences
in interfaceBooleanBag
- Specified by:
bottomOccurrences
in interfaceMutableBooleanBag
-
reject
public MutableBooleanBag reject(BooleanPredicate predicate)
- Specified by:
reject
in interfaceBooleanBag
- Specified by:
reject
in interfaceBooleanIterable
- Specified by:
reject
in interfaceMutableBooleanBag
- Specified by:
reject
in interfaceMutableBooleanCollection
-
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)
- Specified by:
chunk
in interfaceBooleanIterable
-
equals
public boolean equals(Object otherBag)
- Specified by:
equals
in interfaceBooleanBag
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceBooleanBag
- Overrides:
hashCode
in classObject
-
toString
public String toString()
- Specified by:
toString
in interfacePrimitiveIterable
- Overrides:
toString
in classObject
-
makeString
public String makeString()
- Specified by:
makeString
in interfacePrimitiveIterable
-
makeString
public String makeString(String separator)
- Specified by:
makeString
in interfacePrimitiveIterable
-
makeString
public String makeString(String start, String separator, String end)
- Specified by:
makeString
in interfacePrimitiveIterable
-
appendString
public void appendString(Appendable appendable)
- Specified by:
appendString
in interfacePrimitiveIterable
-
appendString
public void appendString(Appendable appendable, String separator)
- Specified by:
appendString
in interfacePrimitiveIterable
-
appendString
public void appendString(Appendable appendable, String start, String separator, String end)
- Specified by:
appendString
in interfacePrimitiveIterable
-
count
public int count(BooleanPredicate predicate)
- Specified by:
count
in interfaceBooleanIterable
-
anySatisfy
public boolean anySatisfy(BooleanPredicate predicate)
- Specified by:
anySatisfy
in interfaceBooleanIterable
-
allSatisfy
public boolean allSatisfy(BooleanPredicate predicate)
- Specified by:
allSatisfy
in interfaceBooleanIterable
-
noneSatisfy
public boolean noneSatisfy(BooleanPredicate predicate)
- Specified by:
noneSatisfy
in interfaceBooleanIterable
-
detectIfNone
public boolean detectIfNone(BooleanPredicate predicate, boolean ifNone)
- Specified by:
detectIfNone
in interfaceBooleanIterable
-
collect
public <V> MutableBag<V> collect(BooleanToObjectFunction<? extends V> function)
- Specified by:
collect
in interfaceBooleanBag
- Specified by:
collect
in interfaceBooleanIterable
- Specified by:
collect
in interfaceMutableBooleanBag
- Specified by:
collect
in interfaceMutableBooleanCollection
-
toArray
public boolean[] toArray()
- Specified by:
toArray
in interfaceBooleanIterable
-
toArray
public boolean[] toArray(boolean[] array)
- Specified by:
toArray
in interfaceBooleanIterable
-
toList
public MutableBooleanList toList()
- Specified by:
toList
in interfaceBooleanIterable
-
toSet
public MutableBooleanSet toSet()
- Specified by:
toSet
in interfaceBooleanIterable
-
toBag
public MutableBooleanBag toBag()
- Specified by:
toBag
in interfaceBooleanIterable
-
asLazy
public LazyBooleanIterable asLazy()
- Specified by:
asLazy
in interfaceBooleanIterable
-
booleanIterator
public MutableBooleanIterator booleanIterator()
- Specified by:
booleanIterator
in interfaceBooleanIterable
- Specified by:
booleanIterator
in interfaceMutableBooleanCollection
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
selectUnique
public MutableBooleanSet selectUnique()
- Specified by:
selectUnique
in interfaceBooleanBag
- Specified by:
selectUnique
in interfaceMutableBooleanBag
-
-