Top Description Methods
org.eclipse.collections.api.stack

public Interface StackIterable<T>

extends OrderedIterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.stack.ImmutableStack, org.eclipse.collections.api.stack.MutableStack
Imports
java.util.List, org.eclipse.collections.api.block.function.Function, .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, org.eclipse.collections.api.factory.Stacks, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.multimap.list.ListMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.stack.PartitionStack, org.eclipse.collections.api.stack.primitive.BooleanStack, .ByteStack, .CharStack, .DoubleStack, .FloatStack, .IntStack, .LongStack, .ShortStack, org.eclipse.collections.api.tuple.Pair

StackIterable is a last-in-first-out data structure. All iteration methods iterate from the "top" of the stack to the "bottom". In other words, it processes the most recently added elements first.

For example:

forEach(Procedure) iterates over every element, starting with the most recently added

getFirst() returns the most recently added element, not the element that was added first

toString() follows the same rules as java.util.AbstractCollection#toString() except it processes the elements in the same order as forEach().

Method Summary

Modifier and TypeMethod and Description
public <V> StackIterable<V>
collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collect.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectBoolean.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectByte.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectChar.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectDouble.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectFloat.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 IntStack
collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectInt.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectLong.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.collectWith.

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

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

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

public StackIterable<T>
distinct()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.distinct.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public boolean
equals(Object o)

Follows the same general contract as List#equals(Object), but for Stacks.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.flatCollect.

flatCollect is a special case of collect(Function).

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

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.flatCollectWith.

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

public default T
getFirst()

Implements org.eclipse.collections.api.ordered.OrderedIterable.getFirst.

Should return the same value as peek().

public T
getLast()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.getLast.

Should not work as it violates the contract of a Stack.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> ListMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.groupByEach.

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

public int
hashCode()

Follows the same general contract as List#hashCode(), but for Stacks.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partition.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWhile.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.partitionWith.

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

public T

Returns:

the top of the stack.
peek
()

Returns the element at the top of the stack, without removing it from the stack.

public ListIterable<T>

Returns:

a ListIterable of the number of elements specified by the count, beginning with the top of the stack.
peek
(int count)

public T

Returns:

the element at the specified index
peekAt
(int
the location to peek into
index
)

Returns the element at a specific index, without removing it from the stack.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.reject.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.rejectWith.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.select.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectInstancesOf.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.selectWith.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.takeWhile.

Returns the initial elements that satisfy the Predicate.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.tap.

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

public ImmutableStack<T>
toImmutable()

Converts the StackIterable to an immutable implementation.

public default MutableStack<T>
toStack()

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.toStack.

Converts the stack to a MutableStack implementation.

public String
toString()

Redeclares org.eclipse.collections.api.RichIterable.toString.

Follows the same rules as java.util.AbstractCollection#toString() except it processes the elements in the same order as forEach().

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zip.

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

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zipWithIndex.

Zips this RichIterable with its indices.

Inherited from org.eclipse.collections.api.ordered.OrderedIterable:
collectWithIndexcorrespondsdetectIndexforEachforEachWithIndexforEachWithIndexgetFirstOptionalgetLastOptionalindexOfmaxminrejectWithIndexselectWithIndexzipzipWithIndex

Method Detail

collectback to summary
public <V> StackIterable<V> collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 BooleanStack collectBoolean(BooleanFunction<? super T> booleanFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 ByteStack collectByte(ByteFunction<? super T> byteFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 CharStack collectChar(CharFunction<? super T> charFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 DoubleStack collectDouble(DoubleFunction<? super T> doubleFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 FloatStack collectFloat(FloatFunction<? super T> floatFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 IntStack collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 LongStack collectLong(LongFunction<? super T> longFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 ShortStack collectShort(ShortFunction<? super T> shortFunction)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 StackIterable<T> dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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
equalsback to summary
public boolean equals(Object o)

Follows the same general contract as List#equals(Object), but for Stacks.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<V> flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.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
getFirstback to summary
public default T getFirst()

Implements org.eclipse.collections.api.ordered.OrderedIterable.getFirst.

Should return the same value as peek().

Annotations
@Override
getLastback to summary
public T getLast()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.getLast.

Should not work as it violates the contract of a Stack.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> ListMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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
hashCodeback to summary
public int hashCode()

Follows the same general contract as List#hashCode(), but for Stacks.

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

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 PartitionStack<T> partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> PartitionStack<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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
peekback to summary
public T peek()

Returns the element at the top of the stack, without removing it from the stack.

Returns:T

the top of the stack.

peekback to summary
public ListIterable<T> peek(int count)
Returns:ListIterable<T>

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

peekAtback to summary
public T peekAt(int index)

Returns the element at a specific index, without removing it from the stack.

Parameters
index:int

the location to peek into

Returns:T

the element at the specified index

rejectback to summary
public StackIterable<T> reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 StackIterable<T> select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<S> selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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> StackIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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
takeWhileback to summary
public StackIterable<T> takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 StackIterable<T> tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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
toImmutableback to summary
public ImmutableStack<T> toImmutable()

Converts the StackIterable to an immutable implementation. Returns this for immutable stacks.

Since
5.0
toStackback to summary
public default MutableStack<T> toStack()

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.toStack.

Converts the stack to a MutableStack implementation.

Annotations
@Override
Since
2.0
toStringback to summary
public String toString()

Redeclares org.eclipse.collections.api.RichIterable.toString.

Follows the same rules as java.util.AbstractCollection#toString() except it processes the elements in the same order as forEach().

Assert.assertEquals("[3, 2, 1]", Stacks.mutable.with(1, 2, 3).toString());
Annotations
@Override
zipback to summary
public <S> StackIterable<Pair<T, S>> zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.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 StackIterable<Pair<T, Integer>> zipWithIndex()

Redeclares org.eclipse.collections.api.ordered.OrderedIterable.zipWithIndex.

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

Zips this RichIterable with its indices.

Annotations
@Override