Class SynchronizedShortBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedShortCollection
org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedShortBag
- All Implemented Interfaces:
Serializable
,MutableShortBag
,ShortBag
,MutableShortCollection
,PrimitiveIterable
,ShortIterable
public class SynchronizedShortBag extends AbstractSynchronizedShortCollection implements MutableShortBag
A synchronized view of a
MutableShortBag
. It is imperative that the user manually synchronize on the collection when iterating over it using the
ShortIterator
, as per Collections.synchronizedCollection(Collection)
.
This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableShortBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
Constructor Summary
Constructors Constructor Description SynchronizedShortBag(MutableShortBag bag)
SynchronizedShortBag(MutableShortBag bag, Object newLock)
-
Method Summary
Modifier and Type Method Description void
addOccurrences(short item, int occurrences)
LazyShortIterable
asLazy()
Returns a LazyShortIterable adapter wrapping the source ShortIterable.MutableShortBag
asSynchronized()
MutableShortBag
asUnmodifiable()
MutableList<ShortIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(ShortToObjectFunction<? 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(ShortIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableShortBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(short item)
The occurrences of a distinct item in the bag.MutableShortBag
reject(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.boolean
removeOccurrences(short item, int occurrences)
MutableShortBag
select(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.MutableShortBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableShortSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableShortBag
toImmutable()
Returns an immutable copy of this bag.MutableList<ShortIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedShortBag
with(short element)
SynchronizedShortBag
withAll(ShortIterable elements)
SynchronizedShortBag
without(short element)
SynchronizedShortBag
withoutAll(ShortIterable elements)
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedShortCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, 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, shortIterator, size, sum, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, toString
Methods inherited from interface org.eclipse.collections.api.bag.primitive.MutableShortBag
selectDuplicates, tap
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableShortCollection
add, addAll, addAll, clear, remove, removeAll, removeAll, removeIf, retainAll, retainAll, shortIterator
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ShortBag
toStringOfItemToCount
Methods inherited from interface org.eclipse.collections.api.ShortIterable
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
-
Constructor Details
-
Method Details
-
with
- Specified by:
with
in interfaceMutableShortBag
- Specified by:
with
in interfaceMutableShortCollection
- Overrides:
with
in classAbstractSynchronizedShortCollection
-
without
- Specified by:
without
in interfaceMutableShortBag
- Specified by:
without
in interfaceMutableShortCollection
- Overrides:
without
in classAbstractSynchronizedShortCollection
-
withAll
- Specified by:
withAll
in interfaceMutableShortBag
- Specified by:
withAll
in interfaceMutableShortCollection
- Overrides:
withAll
in classAbstractSynchronizedShortCollection
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableShortBag
- Specified by:
withoutAll
in interfaceMutableShortCollection
- Overrides:
withoutAll
in classAbstractSynchronizedShortCollection
-
addOccurrences
public void addOccurrences(short item, int occurrences)- Specified by:
addOccurrences
in interfaceMutableShortBag
-
removeOccurrences
public boolean removeOccurrences(short item, int occurrences)- Specified by:
removeOccurrences
in interfaceMutableShortBag
-
sizeDistinct
public int sizeDistinct()Description copied from interface:ShortBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceShortBag
-
occurrencesOf
public int occurrencesOf(short item)Description copied from interface:ShortBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceShortBag
-
forEachWithOccurrences
Description copied from interface:ShortBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceShortBag
-
select
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.- Specified by:
select
in interfaceMutableShortBag
- Specified by:
select
in interfaceMutableShortCollection
- Specified by:
select
in interfaceShortBag
- Specified by:
select
in interfaceShortIterable
- Overrides:
select
in classAbstractSynchronizedShortCollection
-
selectByOccurrences
Description copied from interface:MutableShortBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceMutableShortBag
- Specified by:
selectByOccurrences
in interfaceShortBag
-
selectUnique
Description copied from interface:MutableShortBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceMutableShortBag
- Specified by:
selectUnique
in interfaceShortBag
-
topOccurrences
Description copied from interface:MutableShortBag
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 interfaceMutableShortBag
- Specified by:
topOccurrences
in interfaceShortBag
-
bottomOccurrences
Description copied from interface:MutableShortBag
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 interfaceMutableShortBag
- Specified by:
bottomOccurrences
in interfaceShortBag
-
reject
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.- Specified by:
reject
in interfaceMutableShortBag
- Specified by:
reject
in interfaceMutableShortCollection
- Specified by:
reject
in interfaceShortBag
- Specified by:
reject
in interfaceShortIterable
- Overrides:
reject
in classAbstractSynchronizedShortCollection
-
collect
Description copied from interface:ShortIterable
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 interfaceMutableShortBag
- Specified by:
collect
in interfaceMutableShortCollection
- Specified by:
collect
in interfaceShortBag
- Specified by:
collect
in interfaceShortIterable
- Overrides:
collect
in classAbstractSynchronizedShortCollection
-
equals
Description copied from interface:ShortBag
Follows the same general contract asBag.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:ShortBag
Follows the same general contract asBag.hashCode()
. -
asLazy
Description copied from interface:ShortIterable
Returns a LazyShortIterable adapter wrapping the source ShortIterable.- Specified by:
asLazy
in interfaceShortIterable
- Overrides:
asLazy
in classAbstractSynchronizedShortCollection
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableShortBag
- Specified by:
asUnmodifiable
in interfaceMutableShortCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedShortCollection
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableShortBag
- Specified by:
asSynchronized
in interfaceMutableShortCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedShortCollection
-
toImmutable
Description copied from interface:MutableShortBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceMutableShortBag
- Specified by:
toImmutable
in interfaceMutableShortCollection
- Specified by:
toImmutable
in interfaceShortBag
- Overrides:
toImmutable
in classAbstractSynchronizedShortCollection
-
newEmpty
Description copied from interface:MutableShortBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableShortBag
- Specified by:
newEmpty
in interfaceMutableShortCollection
- Since:
- 9.2.
-