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 longserialVersionUID
-
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 voidaddOccurrences(boolean item, int occurrences)LazyBooleanIterableasLazy()Returns a LazyBooleanIterable adapter wrapping the source BooleanIterable.MutableBooleanBagasSynchronized()MutableBooleanBagasUnmodifiable()MutableList<BooleanIntPair>bottomOccurrences(int count)Returns thecountleast 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.booleanequals(java.lang.Object otherBag)Follows the same general contract asBag.equals(Object).voidforEachWithOccurrences(BooleanIntProcedure procedure)For each distinct item, with the number of occurrences, execute the specified procedure.private MutableBooleanBaggetMutableBooleanBag()inthashCode()Follows the same general contract asBag.hashCode().MutableBooleanBagnewEmpty()Creates a new empty mutable version of the same Bag type.intoccurrencesOf(boolean item)The occurrences of a distinct item in the bag.MutableBooleanBagreject(BooleanPredicate predicate)Returns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.booleanremoveOccurrences(boolean item, int occurrences)MutableBooleanBagselect(BooleanPredicate predicate)Returns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.MutableBooleanBagselectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableBooleanSetselectUnique()Returns all elements of the bag that have exactly one occurrence.intsizeDistinct()The size of the Bag when counting only distinct elements.ImmutableBooleanBagtoImmutable()Returns an immutable copy of this bag.MutableList<BooleanIntPair>topOccurrences(int count)Returns thecountmost frequently occurring items.SynchronizedBooleanBagwith(boolean element)SynchronizedBooleanBagwithAll(BooleanIterable elements)SynchronizedBooleanBagwithout(boolean element)SynchronizedBooleanBagwithoutAll(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:
within interfaceMutableBooleanBag- Specified by:
within interfaceMutableBooleanCollection- Overrides:
within classAbstractSynchronizedBooleanCollection
-
without
public SynchronizedBooleanBag without(boolean element)
- Specified by:
withoutin interfaceMutableBooleanBag- Specified by:
withoutin interfaceMutableBooleanCollection- Overrides:
withoutin classAbstractSynchronizedBooleanCollection
-
withAll
public SynchronizedBooleanBag withAll(BooleanIterable elements)
- Specified by:
withAllin interfaceMutableBooleanBag- Specified by:
withAllin interfaceMutableBooleanCollection- Overrides:
withAllin classAbstractSynchronizedBooleanCollection
-
withoutAll
public SynchronizedBooleanBag withoutAll(BooleanIterable elements)
- Specified by:
withoutAllin interfaceMutableBooleanBag- Specified by:
withoutAllin interfaceMutableBooleanCollection- Overrides:
withoutAllin classAbstractSynchronizedBooleanCollection
-
addOccurrences
public void addOccurrences(boolean item, int occurrences)- Specified by:
addOccurrencesin interfaceMutableBooleanBag
-
removeOccurrences
public boolean removeOccurrences(boolean item, int occurrences)- Specified by:
removeOccurrencesin interfaceMutableBooleanBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:BooleanBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceBooleanBag
-
occurrencesOf
public int occurrencesOf(boolean item)
Description copied from interface:BooleanBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceBooleanBag
-
forEachWithOccurrences
public void forEachWithOccurrences(BooleanIntProcedure procedure)
Description copied from interface:BooleanBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceBooleanBag
-
select
public MutableBooleanBag select(BooleanPredicate predicate)
Description copied from interface:BooleanIterableReturns a new BooleanIterable with all of the elements in the BooleanIterable that return true for the specified predicate.- Specified by:
selectin interfaceBooleanBag- Specified by:
selectin interfaceBooleanIterable- Specified by:
selectin interfaceMutableBooleanBag- Specified by:
selectin interfaceMutableBooleanCollection- Overrides:
selectin classAbstractSynchronizedBooleanCollection
-
selectByOccurrences
public MutableBooleanBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableBooleanBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceBooleanBag- Specified by:
selectByOccurrencesin interfaceMutableBooleanBag
-
selectUnique
public MutableBooleanSet selectUnique()
Description copied from interface:MutableBooleanBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceBooleanBag- Specified by:
selectUniquein interfaceMutableBooleanBag
-
topOccurrences
public MutableList<BooleanIntPair> topOccurrences(int count)
Description copied from interface:MutableBooleanBagReturns 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 interfaceBooleanBag- Specified by:
topOccurrencesin interfaceMutableBooleanBag
-
bottomOccurrences
public MutableList<BooleanIntPair> bottomOccurrences(int count)
Description copied from interface:MutableBooleanBagReturns 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 interfaceBooleanBag- Specified by:
bottomOccurrencesin interfaceMutableBooleanBag
-
reject
public MutableBooleanBag reject(BooleanPredicate predicate)
Description copied from interface:BooleanIterableReturns a new BooleanIterable with all of the elements in the BooleanIterable that return false for the specified predicate.- Specified by:
rejectin interfaceBooleanBag- Specified by:
rejectin interfaceBooleanIterable- Specified by:
rejectin interfaceMutableBooleanBag- Specified by:
rejectin interfaceMutableBooleanCollection- Overrides:
rejectin classAbstractSynchronizedBooleanCollection
-
collect
public <V> MutableBag<V> collect(BooleanToObjectFunction<? extends V> function)
Description copied from interface:BooleanIterableReturns 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 interfaceBooleanBag- Specified by:
collectin interfaceBooleanIterable- Specified by:
collectin interfaceMutableBooleanBag- Specified by:
collectin interfaceMutableBooleanCollection- Overrides:
collectin classAbstractSynchronizedBooleanCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:BooleanBagFollows the same general contract asBag.equals(Object).- Specified by:
equalsin interfaceBooleanBag- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:BooleanBagFollows the same general contract asBag.hashCode().- Specified by:
hashCodein interfaceBooleanBag- Overrides:
hashCodein classjava.lang.Object
-
asLazy
public LazyBooleanIterable asLazy()
Description copied from interface:BooleanIterableReturns a LazyBooleanIterable adapter wrapping the source BooleanIterable.- Specified by:
asLazyin interfaceBooleanIterable- Overrides:
asLazyin classAbstractSynchronizedBooleanCollection
-
asUnmodifiable
public MutableBooleanBag asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableBooleanBag- Specified by:
asUnmodifiablein interfaceMutableBooleanCollection- Overrides:
asUnmodifiablein classAbstractSynchronizedBooleanCollection
-
asSynchronized
public MutableBooleanBag asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableBooleanBag- Specified by:
asSynchronizedin interfaceMutableBooleanCollection- Overrides:
asSynchronizedin classAbstractSynchronizedBooleanCollection
-
toImmutable
public ImmutableBooleanBag toImmutable()
Description copied from interface:MutableBooleanBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceBooleanBag- Specified by:
toImmutablein interfaceMutableBooleanBag- Specified by:
toImmutablein interfaceMutableBooleanCollection- Overrides:
toImmutablein classAbstractSynchronizedBooleanCollection
-
newEmpty
public MutableBooleanBag newEmpty()
Description copied from interface:MutableBooleanBagCreates a new empty mutable version of the same Bag type.- Specified by:
newEmptyin interfaceMutableBooleanBag- Specified by:
newEmptyin interfaceMutableBooleanCollection- Since:
- 9.2.
-
-