Top Methods
org.eclipse.collections.api.stack

public Interface MutableStack<T>

extends StackIterable<T>
Imports
java.util.Collection, org.eclipse.collections.api.bag.MutableBag, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ObjectIntToObjectFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.factory.Maps, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.map.primitive.MutableObjectDoubleMap, .MutableObjectLongMap, org.eclipse.collections.api.multimap.list.MutableListMultimap, org.eclipse.collections.api.partition.stack.PartitionMutableStack, org.eclipse.collections.api.stack.primitive.MutableBooleanStack, .MutableByteStack, .MutableCharStack, .MutableDoubleStack, .MutableFloatStack, .MutableIntStack, .MutableLongStack, .MutableShortStack, org.eclipse.collections.api.tuple.Pair

Method Summary

Modifier and TypeMethod and Description
public default <K, V> MutableMap<K, V>
aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public default <K, V> MutableMap<K, V>
aggregateInPlaceBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateInPlaceBy.

Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function.

public MutableStack<T>
public MutableStack<T>
public void
public <V> MutableStack<V>
collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.collect.

Returns a new collection with the results of applying the specified function on each element of the source collection.

public MutableBooleanStack
collectBoolean(BooleanFunction<? super T> booleanFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectBoolean.

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection.

public MutableByteStack
collectByte(ByteFunction<? super T> byteFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectByte.

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection.

public MutableCharStack
collectChar(CharFunction<? super T> charFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectChar.

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection.

public MutableDoubleStack
collectDouble(DoubleFunction<? super T> doubleFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectDouble.

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection.

public MutableFloatStack
collectFloat(FloatFunction<? super T> floatFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectFloat.

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection.

public <V> MutableStack<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectIf.

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public MutableIntStack
collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectInt.

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection.

public MutableLongStack
collectLong(LongFunction<? super T> longFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectLong.

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection.

public MutableShortStack
collectShort(ShortFunction<? super T> shortFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectShort.

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection.

public <P, V> MutableStack<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectWith.

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

public default <V> MutableStack<V>
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.stack.StackIterable.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

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

Overrides default 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.

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

Overrides default 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.

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

Overrides default 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.

public MutableStack<T>
distinct()

Redeclares org.eclipse.collections.api.stack.StackIterable.distinct.

Returns a new OrderedIterable containing the distinct elements in this iterable.

public MutableStack<T>
dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public <V> MutableStack<V>
flatCollect(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.flatCollect.

flatCollect is a special case of collect(Function).

public default <P, V> MutableStack<V>
flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Overrides default org.eclipse.collections.api.stack.StackIterable.flatCollectWith.

Same as flatCollect, only with a Function2 that is passed an extra parameter.

public <V> MutableListMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.groupBy.

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V> MutableListMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public default <V> MutableMap<V, T>
groupByUniqueKey(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.RichIterable.groupByUniqueKey.

For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key.

public PartitionMutableStack<T>
partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public PartitionMutableStack<T>
partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.

public <P> PartitionMutableStack<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public T
pop()

Removes and returns the top element of the stack.

public ListIterable<T>
pop(int count)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack.

public <R extends Collection<T>> R
pop(int count, R targetCollection)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into the targeted collection type.

public <R extends MutableStack<T>> R
pop(int count, R targetStack)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into a new stack.

public void
push(T item)

Adds an item to the top of the stack.

public default <K> MutableMap<K, T>
reduceBy(Function<? super T, ? extends K> groupBy, Function2<? super T, ? super T, ? extends T> reduceFunction)

Overrides default org.eclipse.collections.api.RichIterable.reduceBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public MutableStack<T>
reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> MutableStack<T>
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public MutableStack<T>
select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public <S> MutableStack<S>
selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.stack.StackIterable.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

public <P> MutableStack<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

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

Redeclares org.eclipse.collections.api.RichIterable.sumByDouble.

Groups and sums the values using the two specified functions.

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

Redeclares org.eclipse.collections.api.RichIterable.sumByFloat.

Groups and sums the values using the two specified functions.

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

Redeclares org.eclipse.collections.api.RichIterable.sumByInt.

Groups and sums the values using the two specified functions.

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

Redeclares org.eclipse.collections.api.RichIterable.sumByLong.

Groups and sums the values using the two specified functions.

public MutableStack<T>
takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.takeWhile.

Returns the initial elements that satisfy the Predicate.

public MutableStack<T>
tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.stack.StackIterable.tap.

Executes the Procedure for each element in the iterable and returns this.

public <S> MutableStack<Pair<T, S>>
zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.stack.StackIterable.zip.

Returns a OrderedIterable formed from this OrderedIterable and another Iterable by combining corresponding elements in pairs.

public MutableStack<Pair<T, Integer>>
zipWithIndex()

Redeclares org.eclipse.collections.api.stack.StackIterable.zipWithIndex.

Zips this RichIterable with its indices.

Inherited from org.eclipse.collections.api.stack.StackIterable:
equalsgetFirstgetLasthashCodepeekpeekpeekAttoImmutabletoStacktoString

Method Detail

aggregateByback to summary
public default <K, V> MutableMap<K, V> aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateBy.

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

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. Aggregate results are allowed to be immutable as they will be replaced in place in the map. A second function specifies the initial "zero" aggregate value to work with (i.e. Integer.valueOf(0)).

Annotations
@Override
aggregateInPlaceByback to summary
public default <K, V> MutableMap<K, V> aggregateInPlaceBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateInPlaceBy.

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

Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function. Aggregate results are required to be mutable as they will be changed in place by the procedure. A second function specifies the initial "zero" aggregate value to work with (i.e. new AtomicInteger(0)).

Annotations
@Override
asSynchronizedback to summary
public MutableStack<T> asSynchronized()
asUnmodifiableback to summary
public MutableStack<T> asUnmodifiable()
clearback to summary
public void clear()
collectback to summary
public <V> MutableStack<V> collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.collect.

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

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.

Example using a Java 8 lambda expression:

RichIterable<String> names =
    people.collect(person -> person.getFirstName() + " " + person.getLastName());
Annotations
@Override
collectBooleanback to summary
public MutableBooleanStack collectBoolean(BooleanFunction<? super T> booleanFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectBoolean.

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

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

BooleanIterable licenses =
    people.collectBoolean(person -> person.hasDrivingLicense());
Annotations
@Override
collectByteback to summary
public MutableByteStack collectByte(ByteFunction<? super T> byteFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectByte.

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

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

ByteIterable bytes =
    people.collectByte(person -> person.getCode());
Annotations
@Override
collectCharback to summary
public MutableCharStack collectChar(CharFunction<? super T> charFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectChar.

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

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

CharIterable chars =
    people.collectChar(person -> person.getMiddleInitial());
Annotations
@Override
collectDoubleback to summary
public MutableDoubleStack collectDouble(DoubleFunction<? super T> doubleFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectDouble.

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

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

DoubleIterable doubles =
    people.collectDouble(person -> person.getMilesFromNorthPole());
Annotations
@Override
collectFloatback to summary
public MutableFloatStack collectFloat(FloatFunction<? super T> floatFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectFloat.

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

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

FloatIterable floats =
    people.collectFloat(person -> person.getHeightInInches());
Annotations
@Override
collectIfback to summary
public <V> MutableStack<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectIf.

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

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function).

Example using a Java 8 lambda and method reference:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);

Example using Predicates factory:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
Annotations
@Override
collectIntback to summary
public MutableIntStack collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectInt.

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

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

IntIterable ints =
    people.collectInt(person -> person.getAge());
Annotations
@Override
collectLongback to summary
public MutableLongStack collectLong(LongFunction<? super T> longFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectLong.

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

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

LongIterable longs =
    people.collectLong(person -> person.getGuid());
Annotations
@Override
collectShortback to summary
public MutableShortStack collectShort(ShortFunction<? super T> shortFunction)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectShort.

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

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

ShortIterable shorts =
    people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
Annotations
@Override
collectWithback to summary
public <P, V> MutableStack<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.collectWith.

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

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

Example using a Java 8 lambda expression:

RichIterable<Integer> integers =
    Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
Annotations
@Override
collectWithIndexback to summary
public default <V> MutableStack<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.stack.StackIterable.collectWithIndex.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

Annotations
@Override
Since
9.1.
countByback to summary
public default <V> MutableBag<V> countBy(Function<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.RichIterable.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 default <V> MutableBag<V> countByEach(Function<? super T, ? extends Iterable<V>> function)

Overrides default org.eclipse.collections.api.RichIterable.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 default <V, P> MutableBag<V> countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Overrides default org.eclipse.collections.api.RichIterable.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
distinctback to summary
public MutableStack<T> distinct()

Redeclares org.eclipse.collections.api.stack.StackIterable.distinct.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.distinct.

Returns a new OrderedIterable containing the distinct elements in this iterable.

Conceptually similar to toSet().toList() but retains the original order. If an element appears multiple times in this iterable, the first one will be copied into the result.

Annotations
@Override
dropWhileback to summary
public MutableStack<T> dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.dropWhile.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
flatCollectback to summary
public <V> MutableStack<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.flatCollect.

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

flatCollect is a special case of collect(Function). With collect, when the Function returns a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection instead. This method is commonly called flatMap.

Consider the following example where we have a Person class, and each Person has a list of Address objects. Take the following Function:

Function<Person, List<Address>> addressFunction = Person::getAddresses;
RichIterable<Person> people = ...;
Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);
Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
Annotations
@Override
flatCollectWithback to summary
public default <P, V> MutableStack<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Overrides default org.eclipse.collections.api.stack.StackIterable.flatCollectWith.

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

Same as flatCollect, only with a Function2 that is passed an extra parameter.

Annotations
@Override
Since
9.2
groupByback to summary
public <V> MutableListMultimap<V, T> groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.groupBy.

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

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

Example using a Java 8 method reference:

Multimap<String, Person> peopleByLastName =
    people.groupBy(Person::getLastName);
Annotations
@Override
groupByEachback to summary
public <V> MutableListMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.stack.StackIterable.groupByEach.

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

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

Annotations
@Override
groupByUniqueKeyback to summary
public default <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.RichIterable.groupByUniqueKey.

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

For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key. The generated keys must each be unique, or else an exception is thrown.

Annotations
@Override
partitionback to summary
public PartitionMutableStack<T> partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.partition.

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

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

Example using a Java 8 lambda expression:

PartitionIterable<Person> newYorkersAndNonNewYorkers =
    people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Annotations
@Override
partitionWhileback to summary
public PartitionMutableStack<T> partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.partitionWhile.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
partitionWithback to summary
public <P> PartitionMutableStack<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.partitionWith.

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

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

Example using a Java 8 lambda expression:

PartitionIterable<Person> newYorkersAndNonNewYorkers =
    people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Annotations
@Override
popback to summary
public T pop()

Removes and returns the top element of the stack.

popback to summary
public ListIterable<T> pop(int count)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack.

popback to summary
public <R extends Collection<T>> R pop(int count, R targetCollection)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into the targeted collection type.

popback to summary
public <R extends MutableStack<T>> R pop(int count, R targetStack)

Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into a new stack.

pushback to summary
public void push(T item)

Adds an item to the top of the stack.

reduceByback to summary
public default <K> MutableMap<K, T> reduceBy(Function<? super T, ? extends K> groupBy, Function2<? super T, ? super T, ? extends T> reduceFunction)

Overrides default org.eclipse.collections.api.RichIterable.reduceBy.

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

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. Aggregate results are allowed to be immutable as they will be replaced in place in the map.

Annotations
@Override
rejectback to summary
public MutableStack<T> reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.reject.

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

Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).

Example using a Java 8 lambda expression:

RichIterable<Person> rejected =
    people.reject(person -> person.person.getLastName().equals("Smith"));
Annotations
@Override
rejectWithback to summary
public <P> MutableStack<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.rejectWith.

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

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> rejected =
    people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
Annotations
@Override
selectback to summary
public MutableStack<T> select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.select.

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

Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.

Example using a Java 8 lambda expression:

RichIterable<Person> selected =
    people.select(person -> person.getAddress().getCity().equals("London"));
Annotations
@Override
selectInstancesOfback to summary
public <S> MutableStack<S> selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.stack.StackIterable.selectInstancesOf.

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

Returns all elements of the source collection that are instances of the Class clazz.

RichIterable<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Annotations
@Override
selectWithback to summary
public <P> MutableStack<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.stack.StackIterable.selectWith.

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

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> selected =
    people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
Annotations
@Override
sumByDoubleback to summary
public <V> MutableObjectDoubleMap<V> sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)

Redeclares org.eclipse.collections.api.RichIterable.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> MutableObjectDoubleMap<V> sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)

Redeclares org.eclipse.collections.api.RichIterable.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> MutableObjectLongMap<V> sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)

Redeclares org.eclipse.collections.api.RichIterable.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> MutableObjectLongMap<V> sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)

Redeclares org.eclipse.collections.api.RichIterable.sumByLong.

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

Groups and sums the values using the two specified functions.

Annotations
@Override
takeWhileback to summary
public MutableStack<T> takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.stack.StackIterable.takeWhile.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.takeWhile.

Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.

Annotations
@Override
tapback to summary
public MutableStack<T> tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.stack.StackIterable.tap.

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

Executes the Procedure for each element in the iterable and returns this.

Example using a Java 8 lambda expression:

RichIterable<Person> tapped =
    people.tap(person -> LOGGER.info(person.getName()));
Annotations
@Override
zipback to summary
public <S> MutableStack<Pair<T, S>> zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.stack.StackIterable.zip.

Doc from org.eclipse.collections.api.ordered.OrderedIterable.zip.

Returns a OrderedIterable formed from this OrderedIterable and another Iterable by combining corresponding elements in pairs. The second Iterable should also be ordered. If one of the two Iterables is longer than the other, its remaining elements are ignored.

Annotations
@Override
zipWithIndexback to summary
public MutableStack<Pair<T, Integer>> zipWithIndex()

Redeclares org.eclipse.collections.api.stack.StackIterable.zipWithIndex.

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

Zips this RichIterable with its indices.

Annotations
@Override