Class SynchronizedLongBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedLongCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedLongBag
-
- All Implemented Interfaces:
java.io.Serializable,LongBag,MutableLongBag,MutableLongCollection,LongIterable,PrimitiveIterable
public class SynchronizedLongBag extends AbstractSynchronizedLongCollection implements MutableLongBag
A synchronized view of aMutableLongBag. It is imperative that the user manually synchronize on the collection when iterating over it using theLongIterator, as perCollections.synchronizedCollection(Collection).This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
MutableLongBag.asSynchronized(),MutableBag.asSynchronized(), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description SynchronizedLongBag(MutableLongBag bag)SynchronizedLongBag(MutableLongBag bag, java.lang.Object newLock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOccurrences(long item, int occurrences)LazyLongIterableasLazy()Returns a LazyLongIterable adapter wrapping the source LongIterable.MutableLongBagasSynchronized()MutableLongBagasUnmodifiable()MutableList<LongIntPair>bottomOccurrences(int count)Returns thecountleast frequently occurring items.<V> MutableBag<V>collect(LongToObjectFunction<? 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(LongIntProcedure procedure)For each distinct item, with the number of occurrences, execute the specified procedure.private MutableLongBaggetMutableLongBag()inthashCode()Follows the same general contract asBag.hashCode().MutableLongBagnewEmpty()Creates a new empty mutable version of the same Bag type.intoccurrencesOf(long item)The occurrences of a distinct item in the bag.MutableLongBagreject(LongPredicate predicate)Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.booleanremoveOccurrences(long item, int occurrences)MutableLongBagselect(LongPredicate predicate)Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.MutableLongBagselectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableLongSetselectUnique()Returns all elements of the bag that have exactly one occurrence.intsizeDistinct()The size of the Bag when counting only distinct elements.ImmutableLongBagtoImmutable()Returns an immutable copy of this bag.MutableList<LongIntPair>topOccurrences(int count)Returns thecountmost frequently occurring items.SynchronizedLongBagwith(long element)SynchronizedLongBagwithAll(LongIterable elements)SynchronizedLongBagwithout(long element)SynchronizedLongBagwithoutAll(LongIterable elements)-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedLongCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, average, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getLock, getLongCollection, injectInto, isEmpty, longIterator, 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.LongBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.LongIterable
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.MutableLongBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableLongCollection
add, addAll, addAll, clear, longIterator, 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
-
SynchronizedLongBag
public SynchronizedLongBag(MutableLongBag bag)
-
SynchronizedLongBag
public SynchronizedLongBag(MutableLongBag bag, java.lang.Object newLock)
-
-
Method Detail
-
getMutableLongBag
private MutableLongBag getMutableLongBag()
-
with
public SynchronizedLongBag with(long element)
- Specified by:
within interfaceMutableLongBag- Specified by:
within interfaceMutableLongCollection- Overrides:
within classAbstractSynchronizedLongCollection
-
without
public SynchronizedLongBag without(long element)
- Specified by:
withoutin interfaceMutableLongBag- Specified by:
withoutin interfaceMutableLongCollection- Overrides:
withoutin classAbstractSynchronizedLongCollection
-
withAll
public SynchronizedLongBag withAll(LongIterable elements)
- Specified by:
withAllin interfaceMutableLongBag- Specified by:
withAllin interfaceMutableLongCollection- Overrides:
withAllin classAbstractSynchronizedLongCollection
-
withoutAll
public SynchronizedLongBag withoutAll(LongIterable elements)
- Specified by:
withoutAllin interfaceMutableLongBag- Specified by:
withoutAllin interfaceMutableLongCollection- Overrides:
withoutAllin classAbstractSynchronizedLongCollection
-
addOccurrences
public void addOccurrences(long item, int occurrences)- Specified by:
addOccurrencesin interfaceMutableLongBag
-
removeOccurrences
public boolean removeOccurrences(long item, int occurrences)- Specified by:
removeOccurrencesin interfaceMutableLongBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:LongBagThe size of the Bag when counting only distinct elements.- Specified by:
sizeDistinctin interfaceLongBag
-
occurrencesOf
public int occurrencesOf(long item)
Description copied from interface:LongBagThe occurrences of a distinct item in the bag.- Specified by:
occurrencesOfin interfaceLongBag
-
forEachWithOccurrences
public void forEachWithOccurrences(LongIntProcedure procedure)
Description copied from interface:LongBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceLongBag
-
select
public MutableLongBag select(LongPredicate predicate)
Description copied from interface:LongIterableReturns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.- Specified by:
selectin interfaceLongBag- Specified by:
selectin interfaceLongIterable- Specified by:
selectin interfaceMutableLongBag- Specified by:
selectin interfaceMutableLongCollection- Overrides:
selectin classAbstractSynchronizedLongCollection
-
selectByOccurrences
public MutableLongBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableLongBagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceLongBag- Specified by:
selectByOccurrencesin interfaceMutableLongBag
-
selectUnique
public MutableLongSet selectUnique()
Description copied from interface:MutableLongBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceLongBag- Specified by:
selectUniquein interfaceMutableLongBag
-
topOccurrences
public MutableList<LongIntPair> topOccurrences(int count)
Description copied from interface:MutableLongBagReturns 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 interfaceLongBag- Specified by:
topOccurrencesin interfaceMutableLongBag
-
bottomOccurrences
public MutableList<LongIntPair> bottomOccurrences(int count)
Description copied from interface:MutableLongBagReturns 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 interfaceLongBag- Specified by:
bottomOccurrencesin interfaceMutableLongBag
-
reject
public MutableLongBag reject(LongPredicate predicate)
Description copied from interface:LongIterableReturns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.- Specified by:
rejectin interfaceLongBag- Specified by:
rejectin interfaceLongIterable- Specified by:
rejectin interfaceMutableLongBag- Specified by:
rejectin interfaceMutableLongCollection- Overrides:
rejectin classAbstractSynchronizedLongCollection
-
collect
public <V> MutableBag<V> collect(LongToObjectFunction<? extends V> function)
Description copied from interface:LongIterableReturns 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 interfaceLongBag- Specified by:
collectin interfaceLongIterable- Specified by:
collectin interfaceMutableLongBag- Specified by:
collectin interfaceMutableLongCollection- Overrides:
collectin classAbstractSynchronizedLongCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:LongBagFollows the same general contract asBag.equals(Object).
-
hashCode
public int hashCode()
Description copied from interface:LongBagFollows the same general contract asBag.hashCode().
-
asLazy
public LazyLongIterable asLazy()
Description copied from interface:LongIterableReturns a LazyLongIterable adapter wrapping the source LongIterable.- Specified by:
asLazyin interfaceLongIterable- Overrides:
asLazyin classAbstractSynchronizedLongCollection
-
asUnmodifiable
public MutableLongBag asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableLongBag- Specified by:
asUnmodifiablein interfaceMutableLongCollection- Overrides:
asUnmodifiablein classAbstractSynchronizedLongCollection
-
asSynchronized
public MutableLongBag asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableLongBag- Specified by:
asSynchronizedin interfaceMutableLongCollection- Overrides:
asSynchronizedin classAbstractSynchronizedLongCollection
-
toImmutable
public ImmutableLongBag toImmutable()
Description copied from interface:MutableLongBagReturns an immutable copy of this bag.- Specified by:
toImmutablein interfaceLongBag- Specified by:
toImmutablein interfaceMutableLongBag- Specified by:
toImmutablein interfaceMutableLongCollection- Overrides:
toImmutablein classAbstractSynchronizedLongCollection
-
newEmpty
public MutableLongBag newEmpty()
Description copied from interface:MutableLongBagCreates a new empty mutable version of the same Bag type.- Specified by:
newEmptyin interfaceMutableLongBag- Specified by:
newEmptyin interfaceMutableLongCollection- Since:
- 9.2.
-
-