Class UnmodifiableIntBag
java.lang.Object
org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableIntCollection
org.eclipse.collections.impl.bag.mutable.primitive.UnmodifiableIntBag
- All Implemented Interfaces:
Serializable
,IntBag
,MutableIntBag
,MutableIntCollection
,IntIterable
,PrimitiveIterable
public class UnmodifiableIntBag extends AbstractUnmodifiableIntCollection implements MutableIntBag
This file was automatically generated from template file unmodifiablePrimitiveBag.stg.
- Since:
- 3.1.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description UnmodifiableIntBag(MutableIntBag bag)
-
Method Summary
Modifier and Type Method Description void
addOccurrences(int item, int occurrences)
MutableIntBag
asSynchronized()
MutableIntBag
asUnmodifiable()
MutableList<IntIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(IntToObjectFunction<? 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(IntIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableIntBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(int item)
The occurrences of a distinct item in the bag.MutableIntBag
reject(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.boolean
removeOccurrences(int item, int occurrences)
MutableIntBag
select(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.MutableIntBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableIntSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableIntBag
toImmutable()
Returns an immutable copy of this bag.MutableList<IntIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.UnmodifiableIntBag
with(int element)
UnmodifiableIntBag
withAll(IntIterable elements)
UnmodifiableIntBag
without(int element)
UnmodifiableIntBag
withoutAll(IntIterable elements)
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableIntCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, average, chunk, clear, contains, containsAll, containsAll, count, detectIfNone, each, forEach, injectInto, intIterator, 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.IntBag
toStringOfItemToCount
Methods inherited from interface org.eclipse.collections.api.IntIterable
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.MutableIntBag
selectDuplicates, tap
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableIntCollection
add, addAll, addAll, clear, intIterator, 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 interfaceMutableIntBag
- Specified by:
with
in interfaceMutableIntCollection
- Overrides:
with
in classAbstractUnmodifiableIntCollection
-
without
- Specified by:
without
in interfaceMutableIntBag
- Specified by:
without
in interfaceMutableIntCollection
- Overrides:
without
in classAbstractUnmodifiableIntCollection
-
withAll
- Specified by:
withAll
in interfaceMutableIntBag
- Specified by:
withAll
in interfaceMutableIntCollection
- Overrides:
withAll
in classAbstractUnmodifiableIntCollection
-
withoutAll
- Specified by:
withoutAll
in interfaceMutableIntBag
- Specified by:
withoutAll
in interfaceMutableIntCollection
- Overrides:
withoutAll
in classAbstractUnmodifiableIntCollection
-
addOccurrences
public void addOccurrences(int item, int occurrences)- Specified by:
addOccurrences
in interfaceMutableIntBag
-
removeOccurrences
public boolean removeOccurrences(int item, int occurrences)- Specified by:
removeOccurrences
in interfaceMutableIntBag
-
sizeDistinct
public int sizeDistinct()Description copied from interface:IntBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceIntBag
-
occurrencesOf
public int occurrencesOf(int item)Description copied from interface:IntBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceIntBag
-
forEachWithOccurrences
Description copied from interface:IntBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceIntBag
-
selectByOccurrences
Description copied from interface:MutableIntBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceIntBag
- Specified by:
selectByOccurrences
in interfaceMutableIntBag
-
selectUnique
Description copied from interface:MutableIntBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceIntBag
- Specified by:
selectUnique
in interfaceMutableIntBag
-
topOccurrences
Description copied from interface:MutableIntBag
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 interfaceIntBag
- Specified by:
topOccurrences
in interfaceMutableIntBag
-
bottomOccurrences
Description copied from interface:MutableIntBag
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 interfaceIntBag
- Specified by:
bottomOccurrences
in interfaceMutableIntBag
-
select
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.- Specified by:
select
in interfaceIntBag
- Specified by:
select
in interfaceIntIterable
- Specified by:
select
in interfaceMutableIntBag
- Specified by:
select
in interfaceMutableIntCollection
- Overrides:
select
in classAbstractUnmodifiableIntCollection
-
reject
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.- Specified by:
reject
in interfaceIntBag
- Specified by:
reject
in interfaceIntIterable
- Specified by:
reject
in interfaceMutableIntBag
- Specified by:
reject
in interfaceMutableIntCollection
- Overrides:
reject
in classAbstractUnmodifiableIntCollection
-
collect
Description copied from interface:IntIterable
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 interfaceIntBag
- Specified by:
collect
in interfaceIntIterable
- Specified by:
collect
in interfaceMutableIntBag
- Specified by:
collect
in interfaceMutableIntCollection
- Overrides:
collect
in classAbstractUnmodifiableIntCollection
-
equals
Description copied from interface:IntBag
Follows the same general contract asBag.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:IntBag
Follows the same general contract asBag.hashCode()
. -
asUnmodifiable
- Specified by:
asUnmodifiable
in interfaceMutableIntBag
- Specified by:
asUnmodifiable
in interfaceMutableIntCollection
- Overrides:
asUnmodifiable
in classAbstractUnmodifiableIntCollection
-
asSynchronized
- Specified by:
asSynchronized
in interfaceMutableIntBag
- Specified by:
asSynchronized
in interfaceMutableIntCollection
- Overrides:
asSynchronized
in classAbstractUnmodifiableIntCollection
-
toImmutable
Description copied from interface:MutableIntBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceIntBag
- Specified by:
toImmutable
in interfaceMutableIntBag
- Specified by:
toImmutable
in interfaceMutableIntCollection
- Overrides:
toImmutable
in classAbstractUnmodifiableIntCollection
-
newEmpty
Description copied from interface:MutableIntBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableIntBag
- Specified by:
newEmpty
in interfaceMutableIntCollection
- Since:
- 9.2.
-