Class UnmodifiableBag<T>
java.lang.Object
org.eclipse.collections.impl.collection.mutable.AbstractUnmodifiableMutableCollection<T>
org.eclipse.collections.impl.bag.mutable.UnmodifiableBag<T>
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>,Bag<T>,MutableBag<T>,MutableBagIterable<T>,UnsortedBag<T>,MutableCollection<T>,InternalIterable<T>,RichIterable<T>
public class UnmodifiableBag<T>
extends AbstractUnmodifiableMutableCollection<T>
implements MutableBag<T>, Serializable
An unmodifiable view of a bag.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintaddOccurrences(T item, int occurrences) booleanallSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) booleananySatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) bottomOccurrences(int count) <V> MutableBag<V>collectBoolean(BooleanFunction<? super T> booleanFunction) collectByte(ByteFunction<? super T> byteFunction) collectChar(CharFunction<? super T> charFunction) collectDouble(DoubleFunction<? super T> doubleFunction) collectFloat(FloatFunction<? super T> floatFunction) <V> MutableBag<V>collectInt(IntFunction<? super T> intFunction) collectLong(LongFunction<? super T> longFunction) collectShort(ShortFunction<? super T> shortFunction) <P,A> MutableBag<A> collectWith(Function2<? super T, ? super P, ? extends A> function, P parameter) <V> MutableBag<V>collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function) <V,R extends Collection<V>>
RcollectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function, R target) detectWithOccurrences(ObjectIntPredicate<? super T> predicate) boolean<V> MutableBag<V>flatCollect(Function<? super T, ? extends Iterable<V>> function) voidforEachWithOccurrences(ObjectIntProcedure<? super T> objectIntProcedure) <V> MutableBagMultimap<V,T> <V> MutableBagMultimap<V,T> groupByEach(Function<? super T, ? extends Iterable<V>> function) inthashCode()newEmpty()booleannoneSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) intoccurrencesOf(Object item) static <E,B extends MutableBag<E>>
UnmodifiableBag<E>of(B bag) This method will take a MutableBag and wrap it directly in a UnmodifiableBag.<P> PartitionMutableBag<T>partitionWith(Predicate2<? super T, ? super P> predicate, P parameter) <P> MutableBag<T>rejectWith(Predicate2<? super T, ? super P> predicate, P parameter) booleanremoveOccurrences(Object item, int occurrences) selectByOccurrences(IntPredicate predicate) <S> MutableBag<S>selectInstancesOf(Class<S> clazz) <P> MutableBag<T>selectWith(Predicate2<? super T, ? super P> predicate, P parameter) booleansetOccurrences(T item, int occurrences) int<V> MutableObjectLongMap<V>sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function) <V> MutableObjectLongMap<V>sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function) topOccurrences(int count) withOccurrences(T element, int occurrences) withoutAll(Iterable<? extends T> elements) withoutOccurrences(T element, int occurrences) <S> MutableBag<Pair<T,S>> Deprecated.in 6.0.Deprecated.in 6.0.Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractUnmodifiableMutableCollection
add, addAll, addAllIterable, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsNone, containsNoneIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectWith, size, sumByDouble, sumByFloat, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedList, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toString, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.bag.Bag
aggregateBy, reduceBy, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLongMethods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArrayMethods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndexMethods inherited from interface org.eclipse.collections.api.bag.MutableBag
countBy, countByEach, countByWith, flatCollectWith, selectDuplicates, toImmutableBagMethods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, flatCollectWith, groupByUniqueKey, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, toArray, toArrayMethods inherited from interface org.eclipse.collections.api.RichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceBy, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Method Details
-
of
This method will take a MutableBag and wrap it directly in a UnmodifiableBag. -
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableBag<T>- Specified by:
asUnmodifiablein interfaceMutableCollection<T>- Overrides:
asUnmodifiablein classAbstractUnmodifiableMutableCollection<T>
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableBag<T>- Specified by:
asSynchronizedin interfaceMutableCollection<T>- Overrides:
asSynchronizedin classAbstractUnmodifiableMutableCollection<T>
-
toImmutable
- Specified by:
toImmutablein interfaceBag<T>- Specified by:
toImmutablein interfaceMutableBag<T>- Specified by:
toImmutablein interfaceMutableCollection<T>- Overrides:
toImmutablein classAbstractUnmodifiableMutableCollection<T>
-
equals
-
hashCode
public int hashCode() -
toStringOfItemToCount
- Specified by:
toStringOfItemToCountin interfaceBag<T>
-
newEmpty
- Specified by:
newEmptyin interfaceMutableBag<T>- Specified by:
newEmptyin interfaceMutableCollection<T>- Overrides:
newEmptyin classAbstractUnmodifiableMutableCollection<T>
-
selectByOccurrences
- Specified by:
selectByOccurrencesin interfaceBag<T>- Specified by:
selectByOccurrencesin interfaceMutableBag<T>- Specified by:
selectByOccurrencesin interfaceMutableBagIterable<T>- Specified by:
selectByOccurrencesin interfaceUnsortedBag<T>
-
tap
- Specified by:
tapin interfaceBag<T>- Specified by:
tapin interfaceMutableBag<T>- Specified by:
tapin interfaceMutableBagIterable<T>- Specified by:
tapin interfaceMutableCollection<T>- Specified by:
tapin interfaceRichIterable<T>- Specified by:
tapin interfaceUnsortedBag<T>- Overrides:
tapin classAbstractUnmodifiableMutableCollection<T>
-
select
- Specified by:
selectin interfaceBag<T>- Specified by:
selectin interfaceMutableBag<T>- Specified by:
selectin interfaceMutableBagIterable<T>- Specified by:
selectin interfaceMutableCollection<T>- Specified by:
selectin interfaceRichIterable<T>- Specified by:
selectin interfaceUnsortedBag<T>- Overrides:
selectin classAbstractUnmodifiableMutableCollection<T>
-
selectWith
- Specified by:
selectWithin interfaceBag<T>- Specified by:
selectWithin interfaceMutableBag<T>- Specified by:
selectWithin interfaceMutableBagIterable<T>- Specified by:
selectWithin interfaceMutableCollection<T>- Specified by:
selectWithin interfaceRichIterable<T>- Specified by:
selectWithin interfaceUnsortedBag<T>- Overrides:
selectWithin classAbstractUnmodifiableMutableCollection<T>
-
reject
- Specified by:
rejectin interfaceBag<T>- Specified by:
rejectin interfaceMutableBag<T>- Specified by:
rejectin interfaceMutableBagIterable<T>- Specified by:
rejectin interfaceMutableCollection<T>- Specified by:
rejectin interfaceRichIterable<T>- Specified by:
rejectin interfaceUnsortedBag<T>- Overrides:
rejectin classAbstractUnmodifiableMutableCollection<T>
-
rejectWith
- Specified by:
rejectWithin interfaceBag<T>- Specified by:
rejectWithin interfaceMutableBag<T>- Specified by:
rejectWithin interfaceMutableBagIterable<T>- Specified by:
rejectWithin interfaceMutableCollection<T>- Specified by:
rejectWithin interfaceRichIterable<T>- Specified by:
rejectWithin interfaceUnsortedBag<T>- Overrides:
rejectWithin classAbstractUnmodifiableMutableCollection<T>
-
partition
- Specified by:
partitionin interfaceBag<T>- Specified by:
partitionin interfaceMutableBag<T>- Specified by:
partitionin interfaceMutableBagIterable<T>- Specified by:
partitionin interfaceMutableCollection<T>- Specified by:
partitionin interfaceRichIterable<T>- Specified by:
partitionin interfaceUnsortedBag<T>- Overrides:
partitionin classAbstractUnmodifiableMutableCollection<T>
-
partitionWith
public <P> PartitionMutableBag<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter) - Specified by:
partitionWithin interfaceBag<T>- Specified by:
partitionWithin interfaceMutableBag<T>- Specified by:
partitionWithin interfaceMutableBagIterable<T>- Specified by:
partitionWithin interfaceMutableCollection<T>- Specified by:
partitionWithin interfaceRichIterable<T>- Overrides:
partitionWithin classAbstractUnmodifiableMutableCollection<T>
-
selectInstancesOf
- Specified by:
selectInstancesOfin interfaceBag<T>- Specified by:
selectInstancesOfin interfaceMutableBag<T>- Specified by:
selectInstancesOfin interfaceMutableBagIterable<T>- Specified by:
selectInstancesOfin interfaceMutableCollection<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>- Specified by:
selectInstancesOfin interfaceUnsortedBag<T>- Overrides:
selectInstancesOfin classAbstractUnmodifiableMutableCollection<T>
-
collect
- Specified by:
collectin interfaceMutableBag<T>- Specified by:
collectin interfaceMutableCollection<T>- Specified by:
collectin interfaceRichIterable<T>- Specified by:
collectin interfaceUnsortedBag<T>- Overrides:
collectin classAbstractUnmodifiableMutableCollection<T>
-
collectBoolean
- Specified by:
collectBooleanin interfaceMutableBag<T>- Specified by:
collectBooleanin interfaceMutableCollection<T>- Specified by:
collectBooleanin interfaceRichIterable<T>- Specified by:
collectBooleanin interfaceUnsortedBag<T>- Overrides:
collectBooleanin classAbstractUnmodifiableMutableCollection<T>
-
collectByte
- Specified by:
collectBytein interfaceMutableBag<T>- Specified by:
collectBytein interfaceMutableCollection<T>- Specified by:
collectBytein interfaceRichIterable<T>- Specified by:
collectBytein interfaceUnsortedBag<T>- Overrides:
collectBytein classAbstractUnmodifiableMutableCollection<T>
-
collectChar
- Specified by:
collectCharin interfaceMutableBag<T>- Specified by:
collectCharin interfaceMutableCollection<T>- Specified by:
collectCharin interfaceRichIterable<T>- Specified by:
collectCharin interfaceUnsortedBag<T>- Overrides:
collectCharin classAbstractUnmodifiableMutableCollection<T>
-
collectDouble
- Specified by:
collectDoublein interfaceMutableBag<T>- Specified by:
collectDoublein interfaceMutableCollection<T>- Specified by:
collectDoublein interfaceRichIterable<T>- Specified by:
collectDoublein interfaceUnsortedBag<T>- Overrides:
collectDoublein classAbstractUnmodifiableMutableCollection<T>
-
collectFloat
- Specified by:
collectFloatin interfaceMutableBag<T>- Specified by:
collectFloatin interfaceMutableCollection<T>- Specified by:
collectFloatin interfaceRichIterable<T>- Specified by:
collectFloatin interfaceUnsortedBag<T>- Overrides:
collectFloatin classAbstractUnmodifiableMutableCollection<T>
-
collectInt
- Specified by:
collectIntin interfaceMutableBag<T>- Specified by:
collectIntin interfaceMutableCollection<T>- Specified by:
collectIntin interfaceRichIterable<T>- Specified by:
collectIntin interfaceUnsortedBag<T>- Overrides:
collectIntin classAbstractUnmodifiableMutableCollection<T>
-
collectLong
- Specified by:
collectLongin interfaceMutableBag<T>- Specified by:
collectLongin interfaceMutableCollection<T>- Specified by:
collectLongin interfaceRichIterable<T>- Specified by:
collectLongin interfaceUnsortedBag<T>- Overrides:
collectLongin classAbstractUnmodifiableMutableCollection<T>
-
collectShort
- Specified by:
collectShortin interfaceMutableBag<T>- Specified by:
collectShortin interfaceMutableCollection<T>- Specified by:
collectShortin interfaceRichIterable<T>- Specified by:
collectShortin interfaceUnsortedBag<T>- Overrides:
collectShortin classAbstractUnmodifiableMutableCollection<T>
-
flatCollect
- Specified by:
flatCollectin interfaceMutableBag<T>- Specified by:
flatCollectin interfaceMutableCollection<T>- Specified by:
flatCollectin interfaceRichIterable<T>- Specified by:
flatCollectin interfaceUnsortedBag<T>- Overrides:
flatCollectin classAbstractUnmodifiableMutableCollection<T>
-
topOccurrences
- Specified by:
topOccurrencesin interfaceBag<T>- Specified by:
topOccurrencesin interfaceMutableBagIterable<T>
-
bottomOccurrences
- Specified by:
bottomOccurrencesin interfaceBag<T>- Specified by:
bottomOccurrencesin interfaceMutableBagIterable<T>
-
collectWithOccurrences
public <V> MutableBag<V> collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function) - Specified by:
collectWithOccurrencesin interfaceBag<T>- Specified by:
collectWithOccurrencesin interfaceMutableBag<T>- Specified by:
collectWithOccurrencesin interfaceMutableBagIterable<T>- Specified by:
collectWithOccurrencesin interfaceUnsortedBag<T>
-
collectWith
public <P,A> MutableBag<A> collectWith(Function2<? super T, ? super P, ? extends A> function, P parameter) - Specified by:
collectWithin interfaceMutableBag<T>- Specified by:
collectWithin interfaceMutableCollection<T>- Specified by:
collectWithin interfaceRichIterable<T>- Specified by:
collectWithin interfaceUnsortedBag<T>- Overrides:
collectWithin classAbstractUnmodifiableMutableCollection<T>
-
collectIf
public <V> MutableBag<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function) - Specified by:
collectIfin interfaceMutableBag<T>- Specified by:
collectIfin interfaceMutableCollection<T>- Specified by:
collectIfin interfaceRichIterable<T>- Specified by:
collectIfin interfaceUnsortedBag<T>- Overrides:
collectIfin classAbstractUnmodifiableMutableCollection<T>
-
groupBy
- Specified by:
groupByin interfaceBag<T>- Specified by:
groupByin interfaceMutableBag<T>- Specified by:
groupByin interfaceMutableBagIterable<T>- Specified by:
groupByin interfaceMutableCollection<T>- Specified by:
groupByin interfaceRichIterable<T>- Specified by:
groupByin interfaceUnsortedBag<T>- Overrides:
groupByin classAbstractUnmodifiableMutableCollection<T>
-
groupByEach
- Specified by:
groupByEachin interfaceBag<T>- Specified by:
groupByEachin interfaceMutableBag<T>- Specified by:
groupByEachin interfaceMutableBagIterable<T>- Specified by:
groupByEachin interfaceMutableCollection<T>- Specified by:
groupByEachin interfaceRichIterable<T>- Specified by:
groupByEachin interfaceUnsortedBag<T>- Overrides:
groupByEachin classAbstractUnmodifiableMutableCollection<T>
-
addOccurrences
- Specified by:
addOccurrencesin interfaceMutableBagIterable<T>
-
removeOccurrences
- Specified by:
removeOccurrencesin interfaceMutableBagIterable<T>
-
setOccurrences
- Specified by:
setOccurrencesin interfaceMutableBagIterable<T>
-
sizeDistinct
public int sizeDistinct()- Specified by:
sizeDistinctin interfaceBag<T>
-
occurrencesOf
- Specified by:
occurrencesOfin interfaceBag<T>
-
forEachWithOccurrences
- Specified by:
forEachWithOccurrencesin interfaceBag<T>
-
anySatisfyWithOccurrences
- Specified by:
anySatisfyWithOccurrencesin interfaceBag<T>
-
allSatisfyWithOccurrences
- Specified by:
allSatisfyWithOccurrencesin interfaceBag<T>
-
noneSatisfyWithOccurrences
- Specified by:
noneSatisfyWithOccurrencesin interfaceBag<T>
-
detectWithOccurrences
- Specified by:
detectWithOccurrencesin interfaceBag<T>
-
collectWithOccurrences
public <V,R extends Collection<V>> R collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function, R target) - Specified by:
collectWithOccurrencesin interfaceBag<T>- Since:
- 9.1.
-
toMapOfItemToCount
- Specified by:
toMapOfItemToCountin interfaceBag<T>- Specified by:
toMapOfItemToCountin interfaceMutableBag<T>- Specified by:
toMapOfItemToCountin interfaceMutableBagIterable<T>
-
zip
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)instead.- Specified by:
zipin interfaceMutableBag<T>- Specified by:
zipin interfaceMutableCollection<T>- Specified by:
zipin interfaceRichIterable<T>- Specified by:
zipin interfaceUnsortedBag<T>- Overrides:
zipin classAbstractUnmodifiableMutableCollection<T>
-
zipWithIndex
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()instead.- Specified by:
zipWithIndexin interfaceBag<T>- Specified by:
zipWithIndexin interfaceMutableBag<T>- Specified by:
zipWithIndexin interfaceMutableBagIterable<T>- Specified by:
zipWithIndexin interfaceMutableCollection<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Specified by:
zipWithIndexin interfaceUnsortedBag<T>- Overrides:
zipWithIndexin classAbstractUnmodifiableMutableCollection<T>
-
with
- Specified by:
within interfaceMutableBag<T>- Specified by:
within interfaceMutableBagIterable<T>- Specified by:
within interfaceMutableCollection<T>- Overrides:
within classAbstractUnmodifiableMutableCollection<T>
-
without
- Specified by:
withoutin interfaceMutableBag<T>- Specified by:
withoutin interfaceMutableBagIterable<T>- Specified by:
withoutin interfaceMutableCollection<T>- Overrides:
withoutin classAbstractUnmodifiableMutableCollection<T>
-
withOccurrences
- Specified by:
withOccurrencesin interfaceMutableBag<T>- Specified by:
withOccurrencesin interfaceMutableBagIterable<T>
-
withoutOccurrences
- Specified by:
withoutOccurrencesin interfaceMutableBag<T>- Specified by:
withoutOccurrencesin interfaceMutableBagIterable<T>
-
withAll
- Specified by:
withAllin interfaceMutableBag<T>- Specified by:
withAllin interfaceMutableBagIterable<T>- Specified by:
withAllin interfaceMutableCollection<T>- Overrides:
withAllin classAbstractUnmodifiableMutableCollection<T>
-
withoutAll
- Specified by:
withoutAllin interfaceMutableBag<T>- Specified by:
withoutAllin interfaceMutableBagIterable<T>- Specified by:
withoutAllin interfaceMutableCollection<T>- Overrides:
withoutAllin classAbstractUnmodifiableMutableCollection<T>
-
selectUnique
- Specified by:
selectUniquein interfaceBag<T>- Specified by:
selectUniquein interfaceMutableBag<T>- Specified by:
selectUniquein interfaceMutableBagIterable<T>- Specified by:
selectUniquein interfaceUnsortedBag<T>
-
sumByInt
public <V> MutableObjectLongMap<V> sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function) - Specified by:
sumByIntin interfaceMutableCollection<T>- Specified by:
sumByIntin interfaceRichIterable<T>- Overrides:
sumByIntin classAbstractUnmodifiableMutableCollection<T>
-
sumByLong
public <V> MutableObjectLongMap<V> sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function) - Specified by:
sumByLongin interfaceMutableCollection<T>- Specified by:
sumByLongin interfaceRichIterable<T>- Overrides:
sumByLongin classAbstractUnmodifiableMutableCollection<T>
-
distinctView
- Specified by:
distinctViewin interfaceBag<T>
-