Class UnmodifiableLongBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableLongCollection
org.eclipse.collections.impl.bag.mutable.primitive.UnmodifiableLongBag
- All Implemented Interfaces:
Serializable
,LongBag
,MutableLongBag
,MutableLongCollection
,LongIterable
,PrimitiveIterable
public class UnmodifiableLongBag extends AbstractUnmodifiableLongCollection implements MutableLongBag
This file was automatically generated from template file unmodifiablePrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description UnmodifiableLongBag(MutableLongBag bag)
-
Method Summary
Modifier and Type Method Description void
addOccurrences(long item, int occurrences)
MutableLongBag
asSynchronized()
MutableLongBag
asUnmodifiable()
MutableList<LongIntPair>
bottomOccurrences(int count)
Returns thecount
least 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.boolean
equals(Object otherBag)
Follows the same general contract asBag.equals(Object)
.void
forEachWithOccurrences(LongIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableLongBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(long item)
The occurrences of a distinct item in the bag.MutableLongBag
reject(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.boolean
removeOccurrences(long item, int occurrences)
MutableLongBag
select(LongPredicate predicate)
Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.MutableLongBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableLongSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableLongBag
toImmutable()
Returns an immutable copy of this bag.MutableList<LongIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.UnmodifiableLongBag
with(long element)
UnmodifiableLongBag
withAll(LongIterable elements)
UnmodifiableLongBag
without(long element)
UnmodifiableLongBag
withoutAll(LongIterable elements)
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableLongCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, average, chunk, clear, contains, containsAll, containsAll, count, detectIfNone, each, forEach, 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 interface org.eclipse.collections.api.bag.primitive.LongBag
toStringOfItemToCount
Methods inherited from interface org.eclipse.collections.api.LongIterable
allSatisfy, anySatisfy, asLazy, 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.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
-
Constructor Details
-
Method Details
-
with
- Specified by:
with
in interfaceMutableLongBag
- Specified by:
with
in interfaceMutableLongCollection
- Overrides:
with
in classAbstractUnmodifiableLongCollection
-
without
- Specified by:
without
in interfaceMutableLongBag
- Specified by:
without
in interfaceMutableLongCollection
- Overrides:
without
in classAbstractUnmodifiableLongCollection
-
withAll
- Specified by:
withAll
in interfaceMutableLongBag
- Specified by:
withAll
in interfaceMutableLongCollection
- Overrides:
withAll
in classAbstractUnmodifiableLongCollection
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableLongBag
- Specified by:
withoutAll
in interfaceMutableLongCollection
- Overrides:
withoutAll
in classAbstractUnmodifiableLongCollection
-
addOccurrences
public void addOccurrences(long item, int occurrences)- Specified by:
addOccurrences
in interfaceMutableLongBag
-
removeOccurrences
public boolean removeOccurrences(long item, int occurrences)- Specified by:
removeOccurrences
in interfaceMutableLongBag
-
sizeDistinct
public int sizeDistinct()Description copied from interface:LongBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceLongBag
-
occurrencesOf
public int occurrencesOf(long item)Description copied from interface:LongBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceLongBag
-
forEachWithOccurrences
Description copied from interface:LongBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceLongBag
-
selectByOccurrences
Description copied from interface:MutableLongBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceLongBag
- Specified by:
selectByOccurrences
in interfaceMutableLongBag
-
selectUnique
Description copied from interface:MutableLongBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceLongBag
- Specified by:
selectUnique
in interfaceMutableLongBag
-
topOccurrences
Description copied from interface:MutableLongBag
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 interfaceLongBag
- Specified by:
topOccurrences
in interfaceMutableLongBag
-
bottomOccurrences
Description copied from interface:MutableLongBag
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 interfaceLongBag
- Specified by:
bottomOccurrences
in interfaceMutableLongBag
-
select
Description copied from interface:LongIterable
Returns a new LongIterable with all of the elements in the LongIterable that return true for the specified predicate.- Specified by:
select
in interfaceLongBag
- Specified by:
select
in interfaceLongIterable
- Specified by:
select
in interfaceMutableLongBag
- Specified by:
select
in interfaceMutableLongCollection
- Overrides:
select
in classAbstractUnmodifiableLongCollection
-
reject
Description copied from interface:LongIterable
Returns a new LongIterable with all of the elements in the LongIterable that return false for the specified predicate.- Specified by:
reject
in interfaceLongBag
- Specified by:
reject
in interfaceLongIterable
- Specified by:
reject
in interfaceMutableLongBag
- Specified by:
reject
in interfaceMutableLongCollection
- Overrides:
reject
in classAbstractUnmodifiableLongCollection
-
collect
Description copied from interface:LongIterable
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 interfaceLongBag
- Specified by:
collect
in interfaceLongIterable
- Specified by:
collect
in interfaceMutableLongBag
- Specified by:
collect
in interfaceMutableLongCollection
- Overrides:
collect
in classAbstractUnmodifiableLongCollection
-
equals
Description copied from interface:LongBag
Follows the same general contract asBag.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:LongBag
Follows the same general contract asBag.hashCode()
. -
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableLongBag
- Specified by:
asUnmodifiable
in interfaceMutableLongCollection
- Overrides:
asUnmodifiable
in classAbstractUnmodifiableLongCollection
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableLongBag
- Specified by:
asSynchronized
in interfaceMutableLongCollection
- Overrides:
asSynchronized
in classAbstractUnmodifiableLongCollection
-
toImmutable
Description copied from interface:MutableLongBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceLongBag
- Specified by:
toImmutable
in interfaceMutableLongBag
- Specified by:
toImmutable
in interfaceMutableLongCollection
- Overrides:
toImmutable
in classAbstractUnmodifiableLongCollection
-
newEmpty
Description copied from interface:MutableLongBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableLongBag
- Specified by:
newEmpty
in interfaceMutableLongCollection
- Since:
- 9.2.
-