Class SynchronizedCharBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedCharCollection
org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedCharBag
- All Implemented Interfaces:
Serializable
,CharBag
,MutableCharBag
,CharIterable
,MutableCharCollection
,PrimitiveIterable
public class SynchronizedCharBag extends AbstractSynchronizedCharCollection implements MutableCharBag
A synchronized view of a
MutableCharBag
. It is imperative that the user manually synchronize on the collection when iterating over it using the
CharIterator
, as per Collections.synchronizedCollection(Collection)
.
This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableCharBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
Constructor Summary
Constructors Constructor Description SynchronizedCharBag(MutableCharBag bag)
SynchronizedCharBag(MutableCharBag bag, Object newLock)
-
Method Summary
Modifier and Type Method Description void
addOccurrences(char item, int occurrences)
LazyCharIterable
asLazy()
Returns a LazyCharIterable adapter wrapping the source CharIterable.MutableCharBag
asSynchronized()
MutableCharBag
asUnmodifiable()
MutableList<CharIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(CharToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.boolean
equals(Object otherBag)
Follows the same general contract asBag.equals(Object)
.void
forEachWithOccurrences(CharIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableCharBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(char item)
The occurrences of a distinct item in the bag.MutableCharBag
reject(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.boolean
removeOccurrences(char item, int occurrences)
MutableCharBag
select(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.MutableCharBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableCharSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableCharBag
toImmutable()
Returns an immutable copy of this bag.MutableList<CharIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedCharBag
with(char element)
SynchronizedCharBag
withAll(CharIterable elements)
SynchronizedCharBag
without(char element)
SynchronizedCharBag
withoutAll(CharIterable elements)
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedCharCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, charIterator, chunk, clear, contains, containsAll, containsAll, count, detectIfNone, each, forEach, injectInto, 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 interface org.eclipse.collections.api.bag.primitive.CharBag
toStringOfItemToCount
Methods inherited from interface org.eclipse.collections.api.CharIterable
allSatisfy, anySatisfy, average, averageIfEmpty, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, contains, containsAll, containsAll, count, detectIfNone, each, flatCollect, forEach, injectInto, max, maxIfEmpty, median, medianIfEmpty, min, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, reject, select, sum, summaryStatistics, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList
Methods inherited from interface org.eclipse.collections.api.bag.primitive.MutableCharBag
selectDuplicates, tap
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableCharCollection
add, addAll, addAll, charIterator, 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
-
Constructor Details
-
Method Details
-
with
- Specified by:
with
in interfaceMutableCharBag
- Specified by:
with
in interfaceMutableCharCollection
- Overrides:
with
in classAbstractSynchronizedCharCollection
-
without
- Specified by:
without
in interfaceMutableCharBag
- Specified by:
without
in interfaceMutableCharCollection
- Overrides:
without
in classAbstractSynchronizedCharCollection
-
withAll
- Specified by:
withAll
in interfaceMutableCharBag
- Specified by:
withAll
in interfaceMutableCharCollection
- Overrides:
withAll
in classAbstractSynchronizedCharCollection
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableCharBag
- Specified by:
withoutAll
in interfaceMutableCharCollection
- Overrides:
withoutAll
in classAbstractSynchronizedCharCollection
-
addOccurrences
public void addOccurrences(char item, int occurrences)- Specified by:
addOccurrences
in interfaceMutableCharBag
-
removeOccurrences
public boolean removeOccurrences(char item, int occurrences)- Specified by:
removeOccurrences
in interfaceMutableCharBag
-
sizeDistinct
public int sizeDistinct()Description copied from interface:CharBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceCharBag
-
occurrencesOf
public int occurrencesOf(char item)Description copied from interface:CharBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceCharBag
-
forEachWithOccurrences
Description copied from interface:CharBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceCharBag
-
select
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.- Specified by:
select
in interfaceCharBag
- Specified by:
select
in interfaceCharIterable
- Specified by:
select
in interfaceMutableCharBag
- Specified by:
select
in interfaceMutableCharCollection
- Overrides:
select
in classAbstractSynchronizedCharCollection
-
selectByOccurrences
Description copied from interface:MutableCharBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceCharBag
- Specified by:
selectByOccurrences
in interfaceMutableCharBag
-
selectUnique
Description copied from interface:MutableCharBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceCharBag
- Specified by:
selectUnique
in interfaceMutableCharBag
-
topOccurrences
Description copied from interface:MutableCharBag
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 interfaceCharBag
- Specified by:
topOccurrences
in interfaceMutableCharBag
-
bottomOccurrences
Description copied from interface:MutableCharBag
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 interfaceCharBag
- Specified by:
bottomOccurrences
in interfaceMutableCharBag
-
reject
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.- Specified by:
reject
in interfaceCharBag
- Specified by:
reject
in interfaceCharIterable
- Specified by:
reject
in interfaceMutableCharBag
- Specified by:
reject
in interfaceMutableCharCollection
- Overrides:
reject
in classAbstractSynchronizedCharCollection
-
collect
Description copied from interface:CharIterable
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 interfaceCharBag
- Specified by:
collect
in interfaceCharIterable
- Specified by:
collect
in interfaceMutableCharBag
- Specified by:
collect
in interfaceMutableCharCollection
- Overrides:
collect
in classAbstractSynchronizedCharCollection
-
equals
Description copied from interface:CharBag
Follows the same general contract asBag.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:CharBag
Follows the same general contract asBag.hashCode()
. -
asLazy
Description copied from interface:CharIterable
Returns a LazyCharIterable adapter wrapping the source CharIterable.- Specified by:
asLazy
in interfaceCharIterable
- Overrides:
asLazy
in classAbstractSynchronizedCharCollection
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableCharBag
- Specified by:
asUnmodifiable
in interfaceMutableCharCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedCharCollection
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableCharBag
- Specified by:
asSynchronized
in interfaceMutableCharCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedCharCollection
-
toImmutable
Description copied from interface:MutableCharBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceCharBag
- Specified by:
toImmutable
in interfaceMutableCharBag
- Specified by:
toImmutable
in interfaceMutableCharCollection
- Overrides:
toImmutable
in classAbstractSynchronizedCharCollection
-
newEmpty
Description copied from interface:MutableCharBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableCharBag
- Specified by:
newEmpty
in interfaceMutableCharCollection
- Since:
- 9.2.
-