Top Constructors Methods
org.eclipse.collections.impl.bag.immutable

public abstract Class AbstractImmutableBagIterable<T>

extends AbstractBag<T>
implements ImmutableBagIterable<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.bag.ImmutableBagIterable, org.eclipse.collections.api.collection.ImmutableCollection, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable, org.eclipse.collections.api.bag.Bag
Known Direct Subclasses
org.eclipse.collections.impl.bag.sorted.immutable.AbstractImmutableSortedBag, org.eclipse.collections.impl.bag.immutable.AbstractImmutableBag
Imports
java.util.Collection, .List, .Set, .Spliterator, .Spliterators, java.util.stream.Stream, .StreamSupport, org.eclipse.collections.api.bag.ImmutableBag, .ImmutableBagIterable, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, org.eclipse.collections.api.block.predicate.primitive.ObjectIntPredicate, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.factory.Bags, .Sets, org.eclipse.collections.api.factory.primitive.ObjectDoubleMaps, .ObjectLongMaps, org.eclipse.collections.api.map.primitive.ImmutableObjectDoubleMap, .ImmutableObjectLongMap, .MutableObjectDoubleMap, .MutableObjectLongMap, org.eclipse.collections.impl.bag.AbstractBag, org.eclipse.collections.impl.block.factory.PrimitiveFunctions

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T t)

Implements java.util.Collection.add.

Ensures that this collection contains the specified element (optional operation).

public boolean
addAll(Collection<? extends T> collection)

Implements java.util.Collection.addAll.

Adds all of the elements in the specified collection to this collection (optional operation).

public Collection<T>
castToCollection()

Implements org.eclipse.collections.api.collection.ImmutableCollection.castToCollection.

This can be overridden in most implementations to just return this.

public void
clear()

Implements java.util.Collection.clear.

Removes all of the elements from this collection (optional operation).

public <V> ImmutableBag<V>
countBy(Function<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.RichIterable.countBy, org.eclipse.collections.api.collection.ImmutableCollection.countBy.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public <V> ImmutableBag<V>
countByEach(Function<? super T, ? extends Iterable<V>> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.countByEach.

Overrides default org.eclipse.collections.api.RichIterable.countByEach, org.eclipse.collections.api.collection.ImmutableCollection.countByEach.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

public <V, P> ImmutableBag<V>
countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Overrides default org.eclipse.collections.api.RichIterable.countByWith, org.eclipse.collections.api.collection.ImmutableCollection.countByWith.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.

public Stream<T>
parallelStream()

Overrides default org.eclipse.collections.api.collection.ImmutableCollection.parallelStream, java.util.Collection.parallelStream.

Returns a possibly parallel Stream with this collection as its source.

public boolean
remove(Object o)

Implements java.util.Collection.remove.

Removes a single instance of the specified element from this collection, if it is present (optional operation).

public boolean
removeAll(Collection<?> collection)

Implements java.util.Collection.removeAll.

Removes all of this collection's elements that are also contained in the specified collection (optional operation).

protected void
removeAllFrom(Iterable<? extends T> elements, MutableCollection<T> result)

public boolean
retainAll(Collection<?> collection)

Implements java.util.Collection.retainAll.

Retains only the elements in this collection that are contained in the specified collection (optional operation).

protected boolean
shortCircuit(T[] elements, int[] occurrences, ObjectIntPredicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)

public Spliterator<T>
public Stream<T>
stream()

Overrides default org.eclipse.collections.api.collection.ImmutableCollection.stream, java.util.Collection.stream.

Returns a sequential Stream with this collection as its source.

public <V> ImmutableObjectDoubleMap<V>
sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByDouble, org.eclipse.collections.api.collection.ImmutableCollection.sumByDouble.

Groups and sums the values using the two specified functions.

public <V> ImmutableObjectDoubleMap<V>
sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByFloat, org.eclipse.collections.api.collection.ImmutableCollection.sumByFloat.

Groups and sums the values using the two specified functions.

public <V> ImmutableObjectLongMap<V>
sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByInt, org.eclipse.collections.api.collection.ImmutableCollection.sumByInt.

Groups and sums the values using the two specified functions.

public <V> ImmutableObjectLongMap<V>
sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByLong, org.eclipse.collections.api.collection.ImmutableCollection.sumByLong.

Groups and sums the values using the two specified functions.

Inherited from org.eclipse.collections.impl.bag.AbstractBag:
collectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcountflatCollectflatCollectBooleanflatCollectByteflatCollectCharflatCollectDoubleflatCollectFloatflatCollectIntflatCollectLongflatCollectShortgroupBygroupByEachinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoWithoccurrencesSortingByrejectrejectWithselectselectWithsumOfDoublesumOfFloatsumOfIntsumOfLongtoArraytoArraytoBagtoListtoListWithOccurrencestoSettoSortedBagtoSortedBagtoSortedListtoSortedSettoSortedSettoStringOfItemToCount

Constructor Detail

AbstractImmutableBagIterableback to summary
public AbstractImmutableBagIterable()

Method Detail

addback to summary
public boolean add(T t)

Implements java.util.Collection.add.

Doc from java.util.Collection.add.

Ensures that this collection contains the specified element (optional operation). Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)

Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.

If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.

Annotations
@Override
addAllback to summary
public boolean addAll(Collection<? extends T> collection)

Implements java.util.Collection.addAll.

Doc from java.util.Collection.addAll.

Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.) If the specified collection has a defined encounter order, processing of its elements generally occurs in that order.

Annotations
@Override
castToCollectionback to summary
public Collection<T> castToCollection()

Implements org.eclipse.collections.api.collection.ImmutableCollection.castToCollection.

Doc from org.eclipse.collections.api.collection.ImmutableCollection.castToCollection.

This can be overridden in most implementations to just return this.

Annotations
@Override
Since
9.0
clearback to summary
public void clear()

Implements java.util.Collection.clear.

Doc from java.util.Collection.clear.

Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.

Annotations
@Override
countByback to summary
public <V> ImmutableBag<V> countBy(Function<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.RichIterable.countBy, org.eclipse.collections.api.collection.ImmutableCollection.countBy.

Doc from org.eclipse.collections.api.RichIterable.countBy.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

Annotations
@Override
Since
9.0
countByEachback to summary
public <V> ImmutableBag<V> countByEach(Function<? super T, ? extends Iterable<V>> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.countByEach.

Overrides default org.eclipse.collections.api.RichIterable.countByEach, org.eclipse.collections.api.collection.ImmutableCollection.countByEach.

Doc from org.eclipse.collections.api.RichIterable.countByEach.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.

Annotations
@Override
Since
10.0.0
countByWithback to summary
public <V, P> ImmutableBag<V> countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Overrides default org.eclipse.collections.api.RichIterable.countByWith, org.eclipse.collections.api.collection.ImmutableCollection.countByWith.

Doc from org.eclipse.collections.api.RichIterable.countByWith.

This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.

Annotations
@Override
Since
9.0
parallelStreamback to summary
public Stream<T> parallelStream()

Overrides default org.eclipse.collections.api.collection.ImmutableCollection.parallelStream, java.util.Collection.parallelStream.

Doc from java.util.Collection.parallelStream.

Returns a possibly parallel Stream with this collection as its source. It is allowable for this method to return a sequential stream.

This method should be overridden when the spliterator() method cannot return a spliterator that is IMMUTABLE, CONCURRENT, or late-binding. (See spliterator() for details.)

Annotations
@Override
Since
9.0
removeback to summary
public boolean remove(Object o)

Implements java.util.Collection.remove.

Doc from java.util.Collection.remove.

Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).

Annotations
@Override
removeAllback to summary
public boolean removeAll(Collection<?> collection)

Implements java.util.Collection.removeAll.

Doc from java.util.Collection.removeAll.

Removes all of this collection's elements that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.

Annotations
@Override
removeAllFromback to summary
protected void removeAllFrom(Iterable<? extends T> elements, MutableCollection<T> result)
retainAllback to summary
public boolean retainAll(Collection<?> collection)

Implements java.util.Collection.retainAll.

Doc from java.util.Collection.retainAll.

Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.

Annotations
@Override
shortCircuitback to summary
protected boolean shortCircuit(T[] elements, int[] occurrences, ObjectIntPredicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)
spliteratorback to summary
public Spliterator<T> spliterator()

Overrides default java.lang.Iterable.spliterator, org.eclipse.collections.api.collection.ImmutableCollection.spliterator, java.util.Collection.spliterator.

Doc from java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Annotations
@Override
Since
9.0
streamback to summary
public Stream<T> stream()

Overrides default org.eclipse.collections.api.collection.ImmutableCollection.stream, java.util.Collection.stream.

Doc from java.util.Collection.stream.

Returns a sequential Stream with this collection as its source.

This method should be overridden when the spliterator() method cannot return a spliterator that is IMMUTABLE, CONCURRENT, or late-binding. (See spliterator() for details.)

Annotations
@Override
Since
9.0
sumByDoubleback to summary
public <V> ImmutableObjectDoubleMap<V> sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByDouble, org.eclipse.collections.api.collection.ImmutableCollection.sumByDouble.

Doc from org.eclipse.collections.api.RichIterable.sumByDouble.

Groups and sums the values using the two specified functions.

Annotations
@Override
sumByFloatback to summary
public <V> ImmutableObjectDoubleMap<V> sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByFloat, org.eclipse.collections.api.collection.ImmutableCollection.sumByFloat.

Doc from org.eclipse.collections.api.RichIterable.sumByFloat.

Groups and sums the values using the two specified functions.

Annotations
@Override
sumByIntback to summary
public <V> ImmutableObjectLongMap<V> sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByInt, org.eclipse.collections.api.collection.ImmutableCollection.sumByInt.

Doc from org.eclipse.collections.api.RichIterable.sumByInt.

Groups and sums the values using the two specified functions.

Annotations
@Override
sumByLongback to summary
public <V> ImmutableObjectLongMap<V> sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)

Implements org.eclipse.collections.api.RichIterable.sumByLong, org.eclipse.collections.api.collection.ImmutableCollection.sumByLong.

Doc from org.eclipse.collections.api.RichIterable.sumByLong.

Groups and sums the values using the two specified functions.

Annotations
@Override