Class SynchronizedIntBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedIntCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedIntBag
-
- All Implemented Interfaces:
java.io.Serializable
,IntBag
,MutableIntBag
,MutableIntCollection
,IntIterable
,PrimitiveIterable
public class SynchronizedIntBag extends AbstractSynchronizedIntCollection implements MutableIntBag
A synchronized view of aMutableIntBag
. It is imperative that the user manually synchronize on the collection when iterating over it using theIntIterator
, as perCollections.synchronizedCollection(Collection)
.This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableIntBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedIntBag(MutableIntBag bag)
SynchronizedIntBag(MutableIntBag bag, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrences(int item, int occurrences)
LazyIntIterable
asLazy()
Returns a LazyIntIterable adapter wrapping the source IntIterable.MutableIntBag
asSynchronized()
MutableIntBag
asUnmodifiable()
MutableList<IntIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(IntToObjectFunction<? 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(IntIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.private MutableIntBag
getMutableIntBag()
int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableIntBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(int item)
The occurrences of a distinct item in the bag.MutableIntBag
reject(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.boolean
removeOccurrences(int item, int occurrences)
MutableIntBag
select(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.MutableIntBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableIntSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableIntBag
toImmutable()
Returns an immutable copy of this bag.MutableList<IntIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedIntBag
with(int element)
SynchronizedIntBag
withAll(IntIterable elements)
SynchronizedIntBag
without(int element)
SynchronizedIntBag
withoutAll(IntIterable elements)
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedIntCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getIntCollection, getLock, injectInto, intIterator, isEmpty, makeString, makeString, makeString, max, maxIfEmpty, median, min, minIfEmpty, noneSatisfy, notEmpty, reduce, reduceIfEmpty, remove, removeAll, removeAll, removeIf, retainAll, retainAll, size, sum, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, 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.IntBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.IntIterable
allSatisfy, anySatisfy, average, averageIfEmpty, 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, max, maxIfEmpty, median, medianIfEmpty, min, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, reject, select, sum, summaryStatistics, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.MutableIntBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableIntCollection
add, addAll, addAll, clear, intIterator, 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
-
SynchronizedIntBag
public SynchronizedIntBag(MutableIntBag bag)
-
SynchronizedIntBag
public SynchronizedIntBag(MutableIntBag bag, java.lang.Object newLock)
-
-
Method Detail
-
getMutableIntBag
private MutableIntBag getMutableIntBag()
-
with
public SynchronizedIntBag with(int element)
- Specified by:
with
in interfaceMutableIntBag
- Specified by:
with
in interfaceMutableIntCollection
- Overrides:
with
in classAbstractSynchronizedIntCollection
-
without
public SynchronizedIntBag without(int element)
- Specified by:
without
in interfaceMutableIntBag
- Specified by:
without
in interfaceMutableIntCollection
- Overrides:
without
in classAbstractSynchronizedIntCollection
-
withAll
public SynchronizedIntBag withAll(IntIterable elements)
- Specified by:
withAll
in interfaceMutableIntBag
- Specified by:
withAll
in interfaceMutableIntCollection
- Overrides:
withAll
in classAbstractSynchronizedIntCollection
-
withoutAll
public SynchronizedIntBag withoutAll(IntIterable elements)
- Specified by:
withoutAll
in interfaceMutableIntBag
- Specified by:
withoutAll
in interfaceMutableIntCollection
- Overrides:
withoutAll
in classAbstractSynchronizedIntCollection
-
addOccurrences
public void addOccurrences(int item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableIntBag
-
removeOccurrences
public boolean removeOccurrences(int item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableIntBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:IntBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceIntBag
-
occurrencesOf
public int occurrencesOf(int item)
Description copied from interface:IntBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceIntBag
-
forEachWithOccurrences
public void forEachWithOccurrences(IntIntProcedure procedure)
Description copied from interface:IntBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceIntBag
-
select
public MutableIntBag select(IntPredicate predicate)
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.- Specified by:
select
in interfaceIntBag
- Specified by:
select
in interfaceIntIterable
- Specified by:
select
in interfaceMutableIntBag
- Specified by:
select
in interfaceMutableIntCollection
- Overrides:
select
in classAbstractSynchronizedIntCollection
-
selectByOccurrences
public MutableIntBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableIntBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceIntBag
- Specified by:
selectByOccurrences
in interfaceMutableIntBag
-
selectUnique
public MutableIntSet selectUnique()
Description copied from interface:MutableIntBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceIntBag
- Specified by:
selectUnique
in interfaceMutableIntBag
-
topOccurrences
public MutableList<IntIntPair> topOccurrences(int count)
Description copied from interface:MutableIntBag
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 interfaceIntBag
- Specified by:
topOccurrences
in interfaceMutableIntBag
-
bottomOccurrences
public MutableList<IntIntPair> bottomOccurrences(int count)
Description copied from interface:MutableIntBag
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 interfaceIntBag
- Specified by:
bottomOccurrences
in interfaceMutableIntBag
-
reject
public MutableIntBag reject(IntPredicate predicate)
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.- Specified by:
reject
in interfaceIntBag
- Specified by:
reject
in interfaceIntIterable
- Specified by:
reject
in interfaceMutableIntBag
- Specified by:
reject
in interfaceMutableIntCollection
- Overrides:
reject
in classAbstractSynchronizedIntCollection
-
collect
public <V> MutableBag<V> collect(IntToObjectFunction<? extends V> function)
Description copied from interface:IntIterable
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 interfaceIntBag
- Specified by:
collect
in interfaceIntIterable
- Specified by:
collect
in interfaceMutableIntBag
- Specified by:
collect
in interfaceMutableIntCollection
- Overrides:
collect
in classAbstractSynchronizedIntCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:IntBag
Follows the same general contract asBag.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:IntBag
Follows the same general contract asBag.hashCode()
.
-
asLazy
public LazyIntIterable asLazy()
Description copied from interface:IntIterable
Returns a LazyIntIterable adapter wrapping the source IntIterable.- Specified by:
asLazy
in interfaceIntIterable
- Overrides:
asLazy
in classAbstractSynchronizedIntCollection
-
asUnmodifiable
public MutableIntBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableIntBag
- Specified by:
asUnmodifiable
in interfaceMutableIntCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedIntCollection
-
asSynchronized
public MutableIntBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableIntBag
- Specified by:
asSynchronized
in interfaceMutableIntCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedIntCollection
-
toImmutable
public ImmutableIntBag toImmutable()
Description copied from interface:MutableIntBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceIntBag
- Specified by:
toImmutable
in interfaceMutableIntBag
- Specified by:
toImmutable
in interfaceMutableIntCollection
- Overrides:
toImmutable
in classAbstractSynchronizedIntCollection
-
newEmpty
public MutableIntBag newEmpty()
Description copied from interface:MutableIntBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableIntBag
- Specified by:
newEmpty
in interfaceMutableIntCollection
- Since:
- 9.2.
-
-