Class SynchronizedDoubleBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedDoubleCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedDoubleBag
-
- All Implemented Interfaces:
java.io.Serializable
,DoubleBag
,MutableDoubleBag
,MutableDoubleCollection
,DoubleIterable
,PrimitiveIterable
public class SynchronizedDoubleBag extends AbstractSynchronizedDoubleCollection implements MutableDoubleBag
A synchronized view of aMutableDoubleBag
. It is imperative that the user manually synchronize on the collection when iterating over it using theDoubleIterator
, as perCollections.synchronizedCollection(Collection)
.This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableDoubleBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedDoubleBag(MutableDoubleBag bag)
SynchronizedDoubleBag(MutableDoubleBag bag, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrences(double item, int occurrences)
LazyDoubleIterable
asLazy()
Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.MutableDoubleBag
asSynchronized()
MutableDoubleBag
asUnmodifiable()
MutableList<DoubleIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(DoubleToObjectFunction<? 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(DoubleIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.private MutableDoubleBag
getMutableDoubleBag()
int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableDoubleBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(double item)
The occurrences of a distinct item in the bag.MutableDoubleBag
reject(DoublePredicate predicate)
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.boolean
removeOccurrences(double item, int occurrences)
MutableDoubleBag
select(DoublePredicate predicate)
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.MutableDoubleBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableDoubleSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableDoubleBag
toImmutable()
Returns an immutable copy of this bag.MutableList<DoubleIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.SynchronizedDoubleBag
with(double element)
SynchronizedDoubleBag
withAll(DoubleIterable elements)
SynchronizedDoubleBag
without(double element)
SynchronizedDoubleBag
withoutAll(DoubleIterable elements)
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedDoubleCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, doubleIterator, each, getDoubleCollection, 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.DoubleBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.DoubleIterable
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.MutableDoubleBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableDoubleCollection
add, addAll, addAll, clear, doubleIterator, 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
-
SynchronizedDoubleBag
public SynchronizedDoubleBag(MutableDoubleBag bag)
-
SynchronizedDoubleBag
public SynchronizedDoubleBag(MutableDoubleBag bag, java.lang.Object newLock)
-
-
Method Detail
-
getMutableDoubleBag
private MutableDoubleBag getMutableDoubleBag()
-
with
public SynchronizedDoubleBag with(double element)
- Specified by:
with
in interfaceMutableDoubleBag
- Specified by:
with
in interfaceMutableDoubleCollection
- Overrides:
with
in classAbstractSynchronizedDoubleCollection
-
without
public SynchronizedDoubleBag without(double element)
- Specified by:
without
in interfaceMutableDoubleBag
- Specified by:
without
in interfaceMutableDoubleCollection
- Overrides:
without
in classAbstractSynchronizedDoubleCollection
-
withAll
public SynchronizedDoubleBag withAll(DoubleIterable elements)
- Specified by:
withAll
in interfaceMutableDoubleBag
- Specified by:
withAll
in interfaceMutableDoubleCollection
- Overrides:
withAll
in classAbstractSynchronizedDoubleCollection
-
withoutAll
public SynchronizedDoubleBag withoutAll(DoubleIterable elements)
- Specified by:
withoutAll
in interfaceMutableDoubleBag
- Specified by:
withoutAll
in interfaceMutableDoubleCollection
- Overrides:
withoutAll
in classAbstractSynchronizedDoubleCollection
-
addOccurrences
public void addOccurrences(double item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableDoubleBag
-
removeOccurrences
public boolean removeOccurrences(double item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableDoubleBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:DoubleBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceDoubleBag
-
occurrencesOf
public int occurrencesOf(double item)
Description copied from interface:DoubleBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceDoubleBag
-
forEachWithOccurrences
public void forEachWithOccurrences(DoubleIntProcedure procedure)
Description copied from interface:DoubleBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceDoubleBag
-
select
public MutableDoubleBag select(DoublePredicate predicate)
Description copied from interface:DoubleIterable
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
select
in interfaceDoubleBag
- Specified by:
select
in interfaceDoubleIterable
- Specified by:
select
in interfaceMutableDoubleBag
- Specified by:
select
in interfaceMutableDoubleCollection
- Overrides:
select
in classAbstractSynchronizedDoubleCollection
-
selectByOccurrences
public MutableDoubleBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableDoubleBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceDoubleBag
- Specified by:
selectByOccurrences
in interfaceMutableDoubleBag
-
selectUnique
public MutableDoubleSet selectUnique()
Description copied from interface:MutableDoubleBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceDoubleBag
- Specified by:
selectUnique
in interfaceMutableDoubleBag
-
topOccurrences
public MutableList<DoubleIntPair> topOccurrences(int count)
Description copied from interface:MutableDoubleBag
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 interfaceDoubleBag
- Specified by:
topOccurrences
in interfaceMutableDoubleBag
-
bottomOccurrences
public MutableList<DoubleIntPair> bottomOccurrences(int count)
Description copied from interface:MutableDoubleBag
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 interfaceDoubleBag
- Specified by:
bottomOccurrences
in interfaceMutableDoubleBag
-
reject
public MutableDoubleBag reject(DoublePredicate predicate)
Description copied from interface:DoubleIterable
Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
reject
in interfaceDoubleBag
- Specified by:
reject
in interfaceDoubleIterable
- Specified by:
reject
in interfaceMutableDoubleBag
- Specified by:
reject
in interfaceMutableDoubleCollection
- Overrides:
reject
in classAbstractSynchronizedDoubleCollection
-
collect
public <V> MutableBag<V> collect(DoubleToObjectFunction<? extends V> function)
Description copied from interface:DoubleIterable
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 interfaceDoubleBag
- Specified by:
collect
in interfaceDoubleIterable
- Specified by:
collect
in interfaceMutableDoubleBag
- Specified by:
collect
in interfaceMutableDoubleCollection
- Overrides:
collect
in classAbstractSynchronizedDoubleCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:DoubleBag
Follows the same general contract asBag.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:DoubleBag
Follows the same general contract asBag.hashCode()
.
-
asLazy
public LazyDoubleIterable asLazy()
Description copied from interface:DoubleIterable
Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.- Specified by:
asLazy
in interfaceDoubleIterable
- Overrides:
asLazy
in classAbstractSynchronizedDoubleCollection
-
asUnmodifiable
public MutableDoubleBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableDoubleBag
- Specified by:
asUnmodifiable
in interfaceMutableDoubleCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedDoubleCollection
-
asSynchronized
public MutableDoubleBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableDoubleBag
- Specified by:
asSynchronized
in interfaceMutableDoubleCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedDoubleCollection
-
toImmutable
public ImmutableDoubleBag toImmutable()
Description copied from interface:MutableDoubleBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceDoubleBag
- Specified by:
toImmutable
in interfaceMutableDoubleBag
- Specified by:
toImmutable
in interfaceMutableDoubleCollection
- Overrides:
toImmutable
in classAbstractSynchronizedDoubleCollection
-
newEmpty
public MutableDoubleBag newEmpty()
Description copied from interface:MutableDoubleBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableDoubleBag
- Specified by:
newEmpty
in interfaceMutableDoubleCollection
- Since:
- 9.2.
-
-