Class UnmodifiableShortBag
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableShortCollection
-
- org.eclipse.collections.impl.bag.mutable.primitive.UnmodifiableShortBag
-
- All Implemented Interfaces:
java.io.Serializable
,MutableShortBag
,ShortBag
,MutableShortCollection
,PrimitiveIterable
,ShortIterable
public class UnmodifiableShortBag extends AbstractUnmodifiableShortCollection implements MutableShortBag
This file was automatically generated from template file unmodifiablePrimitiveBag.stg.- Since:
- 3.1.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description UnmodifiableShortBag(MutableShortBag bag)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrences(short item, int occurrences)
MutableShortBag
asSynchronized()
MutableShortBag
asUnmodifiable()
MutableList<ShortIntPair>
bottomOccurrences(int count)
Returns thecount
least frequently occurring items.<V> MutableBag<V>
collect(ShortToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.boolean
equals(java.lang.Object otherBag)
Follows the same general contract asBag.equals(Object)
.void
forEachWithOccurrences(ShortIntProcedure procedure)
For each distinct item, with the number of occurrences, execute the specified procedure.private MutableShortBag
getMutableShortBag()
int
hashCode()
Follows the same general contract asBag.hashCode()
.MutableShortBag
newEmpty()
Creates a new empty mutable version of the same Bag type.int
occurrencesOf(short item)
The occurrences of a distinct item in the bag.MutableShortBag
reject(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.boolean
removeOccurrences(short item, int occurrences)
MutableShortBag
select(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.MutableShortBag
selectByOccurrences(IntPredicate predicate)
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableShortSet
selectUnique()
Returns all elements of the bag that have exactly one occurrence.int
sizeDistinct()
The size of the Bag when counting only distinct elements.ImmutableShortBag
toImmutable()
Returns an immutable copy of this bag.MutableList<ShortIntPair>
topOccurrences(int count)
Returns thecount
most frequently occurring items.UnmodifiableShortBag
with(short element)
UnmodifiableShortBag
withAll(ShortIterable elements)
UnmodifiableShortBag
without(short element)
UnmodifiableShortBag
withoutAll(ShortIterable elements)
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.primitive.AbstractUnmodifiableShortCollection
add, addAll, addAll, allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, average, chunk, clear, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, getShortCollection, injectInto, isEmpty, makeString, makeString, makeString, max, maxIfEmpty, median, min, minIfEmpty, noneSatisfy, notEmpty, reduce, reduceIfEmpty, remove, removeAll, removeAll, removeIf, retainAll, retainAll, shortIterator, 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.MutableShortBag
selectDuplicates, tap
-
Methods inherited from interface org.eclipse.collections.api.collection.primitive.MutableShortCollection
add, addAll, addAll, clear, remove, removeAll, removeAll, removeIf, retainAll, retainAll, shortIterator
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
Methods inherited from interface org.eclipse.collections.api.bag.primitive.ShortBag
toStringOfItemToCount
-
Methods inherited from interface org.eclipse.collections.api.ShortIterable
allSatisfy, anySatisfy, asLazy, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnmodifiableShortBag
public UnmodifiableShortBag(MutableShortBag bag)
-
-
Method Detail
-
getMutableShortBag
private MutableShortBag getMutableShortBag()
-
with
public UnmodifiableShortBag with(short element)
- Specified by:
with
in interfaceMutableShortBag
- Specified by:
with
in interfaceMutableShortCollection
- Overrides:
with
in classAbstractUnmodifiableShortCollection
-
without
public UnmodifiableShortBag without(short element)
- Specified by:
without
in interfaceMutableShortBag
- Specified by:
without
in interfaceMutableShortCollection
- Overrides:
without
in classAbstractUnmodifiableShortCollection
-
withAll
public UnmodifiableShortBag withAll(ShortIterable elements)
- Specified by:
withAll
in interfaceMutableShortBag
- Specified by:
withAll
in interfaceMutableShortCollection
- Overrides:
withAll
in classAbstractUnmodifiableShortCollection
-
withoutAll
public UnmodifiableShortBag withoutAll(ShortIterable elements)
- Specified by:
withoutAll
in interfaceMutableShortBag
- Specified by:
withoutAll
in interfaceMutableShortCollection
- Overrides:
withoutAll
in classAbstractUnmodifiableShortCollection
-
addOccurrences
public void addOccurrences(short item, int occurrences)
- Specified by:
addOccurrences
in interfaceMutableShortBag
-
removeOccurrences
public boolean removeOccurrences(short item, int occurrences)
- Specified by:
removeOccurrences
in interfaceMutableShortBag
-
sizeDistinct
public int sizeDistinct()
Description copied from interface:ShortBag
The size of the Bag when counting only distinct elements.- Specified by:
sizeDistinct
in interfaceShortBag
-
occurrencesOf
public int occurrencesOf(short item)
Description copied from interface:ShortBag
The occurrences of a distinct item in the bag.- Specified by:
occurrencesOf
in interfaceShortBag
-
forEachWithOccurrences
public void forEachWithOccurrences(ShortIntProcedure procedure)
Description copied from interface:ShortBag
For each distinct item, with the number of occurrences, execute the specified procedure.- Specified by:
forEachWithOccurrences
in interfaceShortBag
-
selectByOccurrences
public MutableShortBag selectByOccurrences(IntPredicate predicate)
Description copied from interface:MutableShortBag
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrences
in interfaceMutableShortBag
- Specified by:
selectByOccurrences
in interfaceShortBag
-
selectUnique
public MutableShortSet selectUnique()
Description copied from interface:MutableShortBag
Returns all elements of the bag that have exactly one occurrence.- Specified by:
selectUnique
in interfaceMutableShortBag
- Specified by:
selectUnique
in interfaceShortBag
-
topOccurrences
public MutableList<ShortIntPair> topOccurrences(int count)
Description copied from interface:MutableShortBag
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 interfaceMutableShortBag
- Specified by:
topOccurrences
in interfaceShortBag
-
bottomOccurrences
public MutableList<ShortIntPair> bottomOccurrences(int count)
Description copied from interface:MutableShortBag
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 interfaceMutableShortBag
- Specified by:
bottomOccurrences
in interfaceShortBag
-
select
public MutableShortBag select(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.- Specified by:
select
in interfaceMutableShortBag
- Specified by:
select
in interfaceMutableShortCollection
- Specified by:
select
in interfaceShortBag
- Specified by:
select
in interfaceShortIterable
- Overrides:
select
in classAbstractUnmodifiableShortCollection
-
reject
public MutableShortBag reject(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.- Specified by:
reject
in interfaceMutableShortBag
- Specified by:
reject
in interfaceMutableShortCollection
- Specified by:
reject
in interfaceShortBag
- Specified by:
reject
in interfaceShortIterable
- Overrides:
reject
in classAbstractUnmodifiableShortCollection
-
collect
public <V> MutableBag<V> collect(ShortToObjectFunction<? extends V> function)
Description copied from interface:ShortIterable
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 interfaceMutableShortBag
- Specified by:
collect
in interfaceMutableShortCollection
- Specified by:
collect
in interfaceShortBag
- Specified by:
collect
in interfaceShortIterable
- Overrides:
collect
in classAbstractUnmodifiableShortCollection
-
equals
public boolean equals(java.lang.Object otherBag)
Description copied from interface:ShortBag
Follows the same general contract asBag.equals(Object)
.
-
hashCode
public int hashCode()
Description copied from interface:ShortBag
Follows the same general contract asBag.hashCode()
.
-
asUnmodifiable
public MutableShortBag asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableShortBag
- Specified by:
asUnmodifiable
in interfaceMutableShortCollection
- Overrides:
asUnmodifiable
in classAbstractUnmodifiableShortCollection
-
asSynchronized
public MutableShortBag asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableShortBag
- Specified by:
asSynchronized
in interfaceMutableShortCollection
- Overrides:
asSynchronized
in classAbstractUnmodifiableShortCollection
-
toImmutable
public ImmutableShortBag toImmutable()
Description copied from interface:MutableShortBag
Returns an immutable copy of this bag.- Specified by:
toImmutable
in interfaceMutableShortBag
- Specified by:
toImmutable
in interfaceMutableShortCollection
- Specified by:
toImmutable
in interfaceShortBag
- Overrides:
toImmutable
in classAbstractUnmodifiableShortCollection
-
newEmpty
public MutableShortBag newEmpty()
Description copied from interface:MutableShortBag
Creates a new empty mutable version of the same Bag type.- Specified by:
newEmpty
in interfaceMutableShortBag
- Specified by:
newEmpty
in interfaceMutableShortCollection
- Since:
- 9.2.
-
-