Class SynchronizedDoubleBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedDoubleCollection
org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedDoubleBag
- All Implemented Interfaces:
Serializable
,DoubleBag
,MutableDoubleBag
,MutableDoubleCollection
,DoubleIterable
,PrimitiveIterable
public class SynchronizedDoubleBag extends AbstractSynchronizedDoubleCollection implements MutableDoubleBag
A synchronized view of a
MutableDoubleBag
. It is imperative that the user manually synchronize on the collection when iterating over it using the
DoubleIterator
, as per Collections.synchronizedCollection(Collection)
.
This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableDoubleBag.asSynchronized()
,MutableBag.asSynchronized()
, Serialized Form
-
Constructor Summary
Constructors Constructor Description SynchronizedDoubleBag(MutableDoubleBag bag)
SynchronizedDoubleBag(MutableDoubleBag bag, Object newLock)
-
Method Summary
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(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.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, count, detectIfNone, doubleIterator, 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.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, 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.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
-
Constructor Details
-
Method Details
-
with
- Specified by:
with
in interfaceMutableDoubleBag
- Specified by:
with
in interfaceMutableDoubleCollection
- Overrides:
with
in classAbstractSynchronizedDoubleCollection
-
without
- Specified by:
without
in interfaceMutableDoubleBag
- Specified by:
without
in interfaceMutableDoubleCollection
- Overrides:
without
in classAbstractSynchronizedDoubleCollection
-
withAll
- Specified by:
withAll
in interfaceMutableDoubleBag
- Specified by:
withAll
in interfaceMutableDoubleCollection
- Overrides:
withAll
in classAbstractSynchronizedDoubleCollection
-
withoutAll
- 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
Description copied from interface:DoubleBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceDoubleBag
-
select
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
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
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
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
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
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
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
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
Description copied from interface:DoubleIterable
Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.- Specified by:
asLazy
in interfaceDoubleIterable
- Overrides:
asLazy
in classAbstractSynchronizedDoubleCollection
-
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableDoubleBag
- Specified by:
asUnmodifiable
in interfaceMutableDoubleCollection
- Overrides:
asUnmodifiable
in classAbstractSynchronizedDoubleCollection
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableDoubleBag
- Specified by:
asSynchronized
in interfaceMutableDoubleCollection
- Overrides:
asSynchronized
in classAbstractSynchronizedDoubleCollection
-
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
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.
-