Class SynchronizedByteBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedByteCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedByteBag
-
- All Implemented Interfaces:
java.io.Serializable
,ByteBag
,MutableByteBag
,ByteIterable
,MutableByteCollection
,PrimitiveIterable
public class SynchronizedByteBag extends AbstractSynchronizedByteCollection implements MutableByteBag
A synchronized view of aMutableByteBag
. It is imperative that the user manually synchronize on the collection when iterating over it using theByteIterator
, as perCollections.synchronizedCollection(Collection)
.This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableByteBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedByteBag(MutableByteBag bag)
SynchronizedByteBag(MutableByteBag bag, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrences(byte item, int occurrences)
LazyByteIterable
asLazy()
Returns a LazyByteIterable adapter wrapping the source ByteIterable.MutableByteBag
asSynchronized()
MutableByteBag
asUnmodifiable()
MutableList<ByteIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(ByteToObjectFunction<? 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(ByteIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.private MutableByteBag
getMutableByteBag()
int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableByteBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(byte item)
The occurrences of a distinct item in the bag.MutableByteBag
reject(BytePredicate predicate)
Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.boolean
removeOccurrences(byte item, int occurrences)
MutableByteBag
select(BytePredicate predicate)
Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.MutableByteBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableByteSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableByteBag
toImmutable()
Returns an immutable copy of this bag.MutableList<ByteIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedByteBag
with(byte element)
SynchronizedByteBag
withAll(ByteIterable elements)
SynchronizedByteBag
without(byte element)
SynchronizedByteBag
withoutAll(ByteIterable elements)
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedByteCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, byteIterator, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getByteCollection, getLock, 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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ByteBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.ByteIterable
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.MutableByteBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableByteCollection
add, addAll, addAll, byteIterator, 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
-
SynchronizedByteBag
public SynchronizedByteBag(MutableByteBag bag)
-
SynchronizedByteBag
public SynchronizedByteBag(MutableByteBag bag, java.lang.Object newLock)
-
-
Method Detail
-
getMutableByteBag
private MutableByteBag getMutableByteBag()
-
with
public SynchronizedByteBag with(byte element)
- Specified by:
with
in interfaceMutableByteBag
- Specified by:
with
in interfaceMutableByteCollection
- Overrides:
with
in classAbstractSynchronizedByteCollection
-
without
public SynchronizedByteBag without(byte element)
- Specified by:
without
in interfaceMutableByteBag
- Specified by:
without
in interfaceMutableByteCollection
- Overrides:
without
in classAbstractSynchronizedByteCollection
-
withAll
public SynchronizedByteBag withAll(ByteIterable elements)
- Specified by:
withAll
in interfaceMutableByteBag
- Specified by:
withAll
in interfaceMutableByteCollection
- Overrides:
withAll
in classAbstractSynchronizedByteCollection
-
withoutAll
public SynchronizedByteBag withoutAll(ByteIterable elements)
- Specified by:
withoutAll
in interfaceMutableByteBag
- Specified by:
withoutAll
in interfaceMutableByteCollection
- Overrides:
withoutAll
in classAbstractSynchronizedByteCollection
-
addOccurrences
public void addOccurrences(byte item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableByteBag
-
removeOccurrences
public boolean removeOccurrences(byte item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableByteBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:ByteBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceByteBag
-
occurrencesOf
public int occurrencesOf(byte item)
Description copied from interface:ByteBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceByteBag
-
forEachWithOccurrences
public void forEachWithOccurrences(ByteIntProcedure procedure)
Description copied from interface:ByteBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceByteBag
-
select
public MutableByteBag select(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.- Specified by:
select
in interfaceByteBag
- Specified by:
select
in interfaceByteIterable
- Specified by:
select
in interfaceMutableByteBag
- Specified by:
select
in interfaceMutableByteCollection
- Overrides:
select
in classAbstractSynchronizedByteCollection
-
selectByOccurrences
public MutableByteBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableByteBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceByteBag
- Specified by:
selectByOccurrences
in interfaceMutableByteBag
-
selectUnique
public MutableByteSet selectUnique()
Description copied from interface:MutableByteBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceByteBag
- Specified by:
selectUnique
in interfaceMutableByteBag
-
topOccurrences
public MutableList<ByteIntPair> topOccurrences(int count)
Description copied from interface:MutableByteBag
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 interfaceByteBag
- Specified by:
topOccurrences
in interfaceMutableByteBag
-
bottomOccurrences
public MutableList<ByteIntPair> bottomOccurrences(int count)
Description copied from interface:MutableByteBag
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 interfaceByteBag
- Specified by:
bottomOccurrences
in interfaceMutableByteBag
-
reject
public MutableByteBag reject(BytePredicate predicate)
Description copied from interface:ByteIterable
Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.- Specified by:
reject
in interfaceByteBag
- Specified by:
reject
in interfaceByteIterable
- Specified by:
reject
in interfaceMutableByteBag
- Specified by:
reject
in interfaceMutableByteCollection
- Overrides:
reject
in classAbstractSynchronizedByteCollection
-
collect
public <V> MutableBag<V> collect(ByteToObjectFunction<? extends V> function)
Description copied from interface:ByteIterable
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 interfaceByteBag
- Specified by:
collect
in interfaceByteIterable
- Specified by:
collect
in interfaceMutableByteBag
- Specified by:
collect
in interfaceMutableByteCollection
- Overrides:
collect
in classAbstractSynchronizedByteCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:ByteBag
Follows the same general contract asBag.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:ByteBag
Follows the same general contract asBag.hashCode()
.
-
asLazy
public LazyByteIterable asLazy()
Description copied from interface:ByteIterable
Returns a LazyByteIterable adapter wrapping the source ByteIterable.- Specified by:
asLazy
in interfaceByteIterable
- Overrides:
asLazy
in classAbstractSynchronizedByteCollection
-
asUnmodifiable
public MutableByteBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableByteBag
- Specified by:
asUnmodifiable
in interfaceMutableByteCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedByteCollection
-
asSynchronized
public MutableByteBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableByteBag
- Specified by:
asSynchronized
in interfaceMutableByteCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedByteCollection
-
toImmutable
public ImmutableByteBag toImmutable()
Description copied from interface:MutableByteBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceByteBag
- Specified by:
toImmutable
in interfaceMutableByteBag
- Specified by:
toImmutable
in interfaceMutableByteCollection
- Overrides:
toImmutable
in classAbstractSynchronizedByteCollection
-
newEmpty
public MutableByteBag newEmpty()
Description copied from interface:MutableByteBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableByteBag
- Specified by:
newEmpty
in interfaceMutableByteCollection
- Since:
- 9.2.
-
-