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 longserialVersionUID
-
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 voidaddOccurrences(double item, int occurrences)LazyDoubleIterableasLazy()Returns a LazyDoubleIterable adapter wrapping the source DoubleIterable.MutableDoubleBagasSynchronized()MutableDoubleBagasUnmodifiable()MutableList<DoubleIntPair>bottomOccurrences(int count)Returns thecountleast 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.booleanequals(java.lang.Object otherBag)Follows the same general contract asBag.equals(Object).voidforEachWithOccurrences(DoubleIntProcedure procedure)For each distinct item, with the number of occurrences, execute the specified procedure.private MutableDoubleBaggetMutableDoubleBag()inthashCode()Follows the same general contract asBag.hashCode().MutableDoubleBagnewEmpty()Creates a new empty mutable version of the same Bag type.intoccurrencesOf(double item)The occurrences of a distinct item in the bag.MutableDoubleBagreject(DoublePredicate predicate)Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.booleanremoveOccurrences(double item, int occurrences)MutableDoubleBagselect(DoublePredicate predicate)Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.MutableDoubleBagselectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableDoubleSetselectUnique()Returns all elements of the bag that have exactly one occurrence.intsizeDistinct()The size of the Bag when counting only distinct elements.ImmutableDoubleBagtoImmutable()Returns an immutable copy of this bag.MutableList<DoubleIntPair>topOccurrences(int count)Returns thecountmost frequently occurring items.SynchronizedDoubleBagwith(double element)SynchronizedDoubleBagwithAll(DoubleIterable elements)SynchronizedDoubleBagwithout(double element)SynchronizedDoubleBagwithoutAll(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:
within interfaceMutableDoubleBag- Specified by:
within interfaceMutableDoubleCollection- Overrides:
within classAbstractSynchronizedDoubleCollection
-
without
public SynchronizedDoubleBag without(double element)
- Specified by:
withoutin interfaceMutableDoubleBag- Specified by:
withoutin interfaceMutableDoubleCollection- Overrides:
withoutin classAbstractSynchronizedDoubleCollection
-
withAll
public SynchronizedDoubleBag withAll(DoubleIterable elements)
- Specified by:
withAllin interfaceMutableDoubleBag- Specified by:
withAllin interfaceMutableDoubleCollection- Overrides:
withAllin classAbstractSynchronizedDoubleCollection
-
withoutAll
public SynchronizedDoubleBag withoutAll(DoubleIterable elements)
- Specified by:
withoutAllin interfaceMutableDoubleBag- Specified by:
withoutAllin interfaceMutableDoubleCollection- Overrides:
withoutAllin classAbstractSynchronizedDoubleCollection
-
addOccurrences
public void addOccurrences(double item, int occurrences)- Specified by:
addOccurrencesin interfaceMutableDoubleBag
-
removeOccurrences
public boolean removeOccurrences(double item, int occurrences)- Specified by:
removeOccurrencesin interfaceMutableDoubleBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:DoubleBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceDoubleBag
-
occurrencesOf
public int occurrencesOf(double item)
Description copied from interface:DoubleBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceDoubleBag
-
forEachWithOccurrences
public void forEachWithOccurrences(DoubleIntProcedure procedure)
Description copied from interface:DoubleBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceDoubleBag
-
select
public MutableDoubleBag select(DoublePredicate predicate)
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
selectin interfaceDoubleBag- Specified by:
selectin interfaceDoubleIterable- Specified by:
selectin interfaceMutableDoubleBag- Specified by:
selectin interfaceMutableDoubleCollection- Overrides:
selectin classAbstractSynchronizedDoubleCollection
-
selectByOccurrences
public MutableDoubleBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableDoubleBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceDoubleBag- Specified by:
selectByOccurrencesin interfaceMutableDoubleBag
-
selectUnique
public MutableDoubleSet selectUnique()
Description copied from interface:MutableDoubleBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceDoubleBag- Specified by:
selectUniquein interfaceMutableDoubleBag
-
topOccurrences
public MutableList<DoubleIntPair> topOccurrences(int count)
Description copied from interface:MutableDoubleBagReturns thecountmost 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:
topOccurrencesin interfaceDoubleBag- Specified by:
topOccurrencesin interfaceMutableDoubleBag
-
bottomOccurrences
public MutableList<DoubleIntPair> bottomOccurrences(int count)
Description copied from interface:MutableDoubleBagReturns thecountleast 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:
bottomOccurrencesin interfaceDoubleBag- Specified by:
bottomOccurrencesin interfaceMutableDoubleBag
-
reject
public MutableDoubleBag reject(DoublePredicate predicate)
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
rejectin interfaceDoubleBag- Specified by:
rejectin interfaceDoubleIterable- Specified by:
rejectin interfaceMutableDoubleBag- Specified by:
rejectin interfaceMutableDoubleCollection- Overrides:
rejectin classAbstractSynchronizedDoubleCollection
-
collect
public <V> MutableBag<V> collect(DoubleToObjectFunction<? extends V> function)
Description copied from interface:DoubleIterableReturns 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:
collectin interfaceDoubleBag- Specified by:
collectin interfaceDoubleIterable- Specified by:
collectin interfaceMutableDoubleBag- Specified by:
collectin interfaceMutableDoubleCollection- Overrides:
collectin classAbstractSynchronizedDoubleCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:DoubleBagFollows the same general contract asBag.equals(Object).
-
hashCode
public int hashCode()
Description copied from interface:DoubleBagFollows the same general contract asBag.hashCode().
-
asLazy
public LazyDoubleIterable asLazy()
Description copied from interface:DoubleIterableReturns a LazyDoubleIterable adapter wrapping the source DoubleIterable.- Specified by:
asLazyin interfaceDoubleIterable- Overrides:
asLazyin classAbstractSynchronizedDoubleCollection
-
asUnmodifiable
public MutableDoubleBag asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableDoubleBag- Specified by:
asUnmodifiablein interfaceMutableDoubleCollection- Overrides:
asUnmodifiablein classAbstractSynchronizedDoubleCollection
-
asSynchronized
public MutableDoubleBag asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableDoubleBag- Specified by:
asSynchronizedin interfaceMutableDoubleCollection- Overrides:
asSynchronizedin classAbstractSynchronizedDoubleCollection
-
toImmutable
public ImmutableDoubleBag toImmutable()
Description copied from interface:MutableDoubleBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceDoubleBag- Specified by:
toImmutablein interfaceMutableDoubleBag- Specified by:
toImmutablein interfaceMutableDoubleCollection- Overrides:
toImmutablein classAbstractSynchronizedDoubleCollection
-
newEmpty
public MutableDoubleBag newEmpty()
Description copied from interface:MutableDoubleBagCreates a new empty mutable version of the same Bag type.- Specified by:
newEmptyin interfaceMutableDoubleBag- Specified by:
newEmptyin interfaceMutableDoubleCollection- Since:
- 9.2.
-
-