Class SynchronizedLongBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedLongCollection
org.eclipse.collections.impl.bag.mutable.primitive.SynchronizedLongBag
- All Implemented Interfaces:
Serializable,LongBag,MutableLongBag,MutableLongCollection,LongIterable,PrimitiveIterable
public class SynchronizedLongBag
extends AbstractSynchronizedLongCollection
implements MutableLongBag
A synchronized view of a
MutableLongBag. It is imperative that the user manually synchronize on the collection when iterating over it using the
LongIterator, as per Collections.synchronizedCollection(Collection).
This file was automatically generated from template file synchronizedPrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOccurrences(long item, int occurrences) asLazy()Returns a LazyLongIterable adapter wrapping the source LongIterable.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.booleanFollows the same general contract asBag.equals(Object).voidforEachWithOccurrences(LongIntProcedure procedure) For each distinct item, with the number of occurrences, execute the specified procedure.inthashCode()Follows the same general contract asBag.hashCode().newEmpty()Creates a new empty mutable version of the same Bag type.intoccurrencesOf(long item) The occurrences of a distinct item in the bag.reject(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) select(LongPredicate predicate) Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.selectByOccurrences(IntPredicate predicate) Returns all elements of the bag that have a number of occurrences that satisfy the predicate.Returns all elements of the bag that have exactly one occurrence.intThe size of the Bag when counting only distinct elements.Returns an immutable copy of this bag.topOccurrences(int count) Returns thecountmost frequently occurring items.with(long element) withAll(LongIterable elements) without(long element) withoutAll(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, 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, toStringMethods inherited from interface org.eclipse.collections.api.bag.primitive.LongBag
toStringOfItemToCountMethods 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, toSortedListByMethods inherited from interface org.eclipse.collections.api.bag.primitive.MutableLongBag
selectDuplicates, tapMethods inherited from interface org.eclipse.collections.api.collection.primitive.MutableLongCollection
add, addAll, addAll, clear, longIterator, remove, removeAll, removeAll, removeIf, retainAll, retainAllMethods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
Constructor Details
-
SynchronizedLongBag
-
SynchronizedLongBag
-
-
Method Details
-
with
- Specified by:
within interfaceMutableLongBag- Specified by:
within interfaceMutableLongCollection- Overrides:
within classAbstractSynchronizedLongCollection
-
without
- Specified by:
withoutin interfaceMutableLongBag- Specified by:
withoutin interfaceMutableLongCollection- Overrides:
withoutin classAbstractSynchronizedLongCollection
-
withAll
- Specified by:
withAllin interfaceMutableLongBag- Specified by:
withAllin interfaceMutableLongCollection- Overrides:
withAllin classAbstractSynchronizedLongCollection
-
withoutAll
- 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
Description copied from interface:LongBagFor each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrencesin interfaceLongBag
-
select
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
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
Description copied from interface:MutableLongBagReturns all elements of the bag that have exactly one occurrence.- Specified by:
selectUniquein interfaceLongBag- Specified by:
selectUniquein interfaceMutableLongBag
-
topOccurrences
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
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
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
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
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
Description copied from interface:LongIterableReturns a LazyLongIterable adapter wrapping the source LongIterable.- Specified by:
asLazyin interfaceLongIterable- Overrides:
asLazyin classAbstractSynchronizedLongCollection
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableLongBag- Specified by:
asUnmodifiablein interfaceMutableLongCollection- Overrides:
asUnmodifiablein classAbstractSynchronizedLongCollection
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableLongBag- Specified by:
asSynchronizedin interfaceMutableLongCollection- Overrides:
asSynchronizedin classAbstractSynchronizedLongCollection
-
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
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.
-