Class SynchronizedBooleanBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedBooleanCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedBooleanBag
-
- All Implemented Interfaces:
java.io.Serializable
,BooleanBag
,MutableBooleanBag
,BooleanIterable
,MutableBooleanCollection
,PrimitiveIterable
public class SynchronizedBooleanBag extends AbstractSynchronizedBooleanCollection implements MutableBooleanBag
A synchronized view of aMutableBooleanBag
. It is imperative that the user manually synchronize on the collection when iterating over it using theBooleanIterator
, as perCollections.synchronizedCollection(Collection)
.This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableBooleanBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedBooleanBag(MutableBooleanBag bag)
SynchronizedBooleanBag(MutableBooleanBag bag, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrences(boolean item, int occurrences)
LazyBooleanIterable
asLazy()
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.MutableBooleanBag
asSynchronized()
MutableBooleanBag
asUnmodifiable()
MutableList<BooleanIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<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
equals(java.lang.Object otherBag)
Follows the same general contract asBag.equals(Object)
.void
forEachWithOccurrences(BooleanIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.private MutableBooleanBag
getMutableBooleanBag()
int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableBooleanBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(boolean item)
The occurrences of a distinct item in the bag.MutableBooleanBag
reject(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.boolean
removeOccurrences(boolean item, int occurrences)
MutableBooleanBag
select(BooleanPredicate predicate)
Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.MutableBooleanBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableBooleanSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableBooleanBag
toImmutable()
Returns an immutable copy of this bag.MutableList<BooleanIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedBooleanBag
with(boolean element)
SynchronizedBooleanBag
withAll(BooleanIterable elements)
SynchronizedBooleanBag
without(boolean element)
SynchronizedBooleanBag
withoutAll(BooleanIterable elements)
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedBooleanCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, booleanIterator, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getBooleanCollection, getLock, injectInto, isEmpty, makeString, makeString, makeString, noneSatisfy, notEmpty, reduce, reduceIfEmpty, remove, removeAll, removeAll, removeIf, retainAll, retainAll, size, toArray, toArray, toBag, toList, toSet, toString
-
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
allSatisfy, anySatisfy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, flatCollect, forEach, injectInto, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, noneSatisfy, reduce, reduceIfEmpty, reject, select, toArray, toArray, toBag, toList, toSet
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.MutableBooleanBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableBooleanCollection
add, addAll, addAll, booleanIterator, clear, remove, removeAll, removeAll, removeIf, retainAll, retainAll
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SynchronizedBooleanBag
public SynchronizedBooleanBag(MutableBooleanBag bag)
-
SynchronizedBooleanBag
public SynchronizedBooleanBag(MutableBooleanBag bag, java.lang.Object newLock)
-
-
Method Detail
-
getMutableBooleanBag
private MutableBooleanBag getMutableBooleanBag()
-
with
public SynchronizedBooleanBag with(boolean element)
- Specified by:
with
in interfaceMutableBooleanBag
- Specified by:
with
in interfaceMutableBooleanCollection
- Overrides:
with
in classAbstractSynchronizedBooleanCollection
-
without
public SynchronizedBooleanBag without(boolean element)
- Specified by:
without
in interfaceMutableBooleanBag
- Specified by:
without
in interfaceMutableBooleanCollection
- Overrides:
without
in classAbstractSynchronizedBooleanCollection
-
withAll
public SynchronizedBooleanBag withAll(BooleanIterable elements)
- Specified by:
withAll
in interfaceMutableBooleanBag
- Specified by:
withAll
in interfaceMutableBooleanCollection
- Overrides:
withAll
in classAbstractSynchronizedBooleanCollection
-
withoutAll
public SynchronizedBooleanBag withoutAll(BooleanIterable elements)
- Specified by:
withoutAll
in interfaceMutableBooleanBag
- Specified by:
withoutAll
in interfaceMutableBooleanCollection
- Overrides:
withoutAll
in classAbstractSynchronizedBooleanCollection
-
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
-
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 procedure)
Description copied from interface:BooleanBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceBooleanBag
-
select
public MutableBooleanBag 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 interfaceMutableBooleanBag
- Specified by:
select
in interfaceMutableBooleanCollection
- Overrides:
select
in classAbstractSynchronizedBooleanCollection
-
selectByOccurrences
public MutableBooleanBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableBooleanBag
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 interfaceMutableBooleanBag
-
selectUnique
public MutableBooleanSet selectUnique()
Description copied from interface:MutableBooleanBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceBooleanBag
- Specified by:
selectUnique
in interfaceMutableBooleanBag
-
topOccurrences
public MutableList<BooleanIntPair> topOccurrences(int count)
Description copied from interface:MutableBooleanBag
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 interfaceMutableBooleanBag
-
bottomOccurrences
public MutableList<BooleanIntPair> bottomOccurrences(int count)
Description copied from interface:MutableBooleanBag
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 interfaceMutableBooleanBag
-
reject
public MutableBooleanBag 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 interfaceMutableBooleanBag
- Specified by:
reject
in interfaceMutableBooleanCollection
- Overrides:
reject
in classAbstractSynchronizedBooleanCollection
-
collect
public <V> MutableBag<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 interfaceMutableBooleanBag
- Specified by:
collect
in interfaceMutableBooleanCollection
- Overrides:
collect
in classAbstractSynchronizedBooleanCollection
-
equals
public boolean equals(java.lang.Object otherBag)
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
-
asLazy
public LazyBooleanIterable asLazy()
Description copied from interface:BooleanIterable
Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.- Specified by:
asLazy
in interfaceBooleanIterable
- Overrides:
asLazy
in classAbstractSynchronizedBooleanCollection
-
asUnmodifiable
public MutableBooleanBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableBooleanBag
- Specified by:
asUnmodifiable
in interfaceMutableBooleanCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedBooleanCollection
-
asSynchronized
public MutableBooleanBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableBooleanBag
- Specified by:
asSynchronized
in interfaceMutableBooleanCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedBooleanCollection
-
toImmutable
public ImmutableBooleanBag toImmutable()
Description copied from interface:MutableBooleanBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceBooleanBag
- Specified by:
toImmutable
in interfaceMutableBooleanBag
- Specified by:
toImmutable
in interfaceMutableBooleanCollection
- Overrides:
toImmutable
in classAbstractSynchronizedBooleanCollection
-
newEmpty
public MutableBooleanBag newEmpty()
Description copied from interface:MutableBooleanBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableBooleanBag
- Specified by:
newEmpty
in interfaceMutableBooleanCollection
- Since:
- 9.2.
-
-