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

public Interface OrderedIterable<T>

extends RichIterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.ordered.ReversibleIterable, org.eclipse.collections.api.ordered.SortedIterable, org.eclipse.collections.api.stack.StackIterable
Imports
java.util.Collection, .List, .NoSuchElementException, .Objects, .Optional, org.eclipse.collections.api.RichIterable, 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.predicate.primitive.ObjectIntPredicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.Stacks, org.eclipse.collections.api.multimap.ordered.OrderedIterableMultimap, org.eclipse.collections.api.ordered.primitive.OrderedBooleanIterable, .OrderedByteIterable, .OrderedCharIterable, .OrderedDoubleIterable, .OrderedFloatIterable, .OrderedIntIterable, .OrderedLongIterable, .OrderedShortIterable, org.eclipse.collections.api.partition.ordered.PartitionOrderedIterable, org.eclipse.collections.api.stack.MutableStack, org.eclipse.collections.api.tuple.Pair

An OrderedIterable is a RichIterable with some meaningful order, such as insertion order, access order, or sorted order.
Since
6.0

Method Summary

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares 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.

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

Redeclares org.eclipse.collections.api.RichIterable.collectWith.

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

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

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

public default <V, R extends Collection<V>> R
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function, R target)

Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.

public <S> boolean
corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate)

Returns true if both OrderedIterables have the same length and predicate returns true for all corresponding elements e1 of this OrderedIterable and e2 of other.

public int
detectIndex(Predicate<? super T> predicate)

Returns the index of the first element of the OrderedIterable for which the predicate evaluates to true.

public OrderedIterable<T>

Returns:

OrderedIterable of distinct elements
distinct
()

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

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

Returns the final elements that do not satisfy the Predicate.

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

Redeclares org.eclipse.collections.api.RichIterable.flatCollect.

flatCollect is a special case of collect(Function).

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

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

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

public void
forEach(int startIndex, int endIndex, Procedure<? super T> procedure)

Iterates over the section of the iterable covered by the specified inclusive indexes.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Redeclares org.eclipse.collections.api.InternalIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure

e.g.
people.forEachWithIndex((person, index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
public void
forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)

Iterates over the section of the iterable covered by the specified inclusive indexes.

public T
getFirst()

Redeclares org.eclipse.collections.api.RichIterable.getFirst.

Returns the first element of an iterable.

public default Optional<T>
getFirstOptional()

Returns the first element of an iterable as an Optional.

public T
getLast()

Redeclares org.eclipse.collections.api.RichIterable.getLast.

Returns the last element of an iterable.

public default Optional<T>
getLastOptional()

Returns the last element of an iterable as an Optional.

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

Redeclares 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.

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

Redeclares 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.

public default int
indexOf(Object object)

Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.

public T
max()

Redeclares org.eclipse.collections.api.RichIterable.max.

Returns the maximum element out of this container based on the natural order, not the order of this container.

public T
min()

Redeclares org.eclipse.collections.api.RichIterable.min.

Returns the minimum element out of this container based on the natural order, not the order of this container.

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

Redeclares org.eclipse.collections.api.RichIterable.partition.

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

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

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

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

Redeclares org.eclipse.collections.api.RichIterable.partitionWith.

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

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

Redeclares org.eclipse.collections.api.RichIterable.reject.

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

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

Redeclares org.eclipse.collections.api.RichIterable.rejectWith.

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

public default <R extends Collection<T>> R
rejectWithIndex(ObjectIntPredicate<? super T> predicate, R target)

Adds all elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.

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

Redeclares org.eclipse.collections.api.RichIterable.select.

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

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

Redeclares org.eclipse.collections.api.RichIterable.selectInstancesOf.

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

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

Redeclares org.eclipse.collections.api.RichIterable.selectWith.

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

public default <R extends Collection<T>> R
selectWithIndex(ObjectIntPredicate<? super T> predicate, R target)

Adds all elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.

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

Returns the initial elements that satisfy the Predicate.

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

Redeclares org.eclipse.collections.api.RichIterable.tap.

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

public default MutableStack<T>
toStack()

Converts the OrderedIterable to a mutable MutableStack implementation.

public <
the type of the second half of the returned pairs
S
>
OrderedIterable<Pair<T, S>>

Returns:

A new OrderedIterable containing pairs consisting of corresponding elements of this OrderedIterable and that. The length of the returned OrderedIterable is the minimum of the lengths of this OrderedIterable and that.
zip
(Iterable<S>
The Iterable providing the second half of each result pair
that
)

Redeclares org.eclipse.collections.api.RichIterable.zip.

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

public <S, R extends Collection<Pair<T, S>>> R
zip(Iterable<S> that, R target)

Redeclares org.eclipse.collections.api.RichIterable.zip.

Same as zip(Iterable) but uses target for output.

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

Redeclares org.eclipse.collections.api.RichIterable.zipWithIndex.

Zips this RichIterable with its indices.

public <R extends Collection<Pair<T, Integer>>> R
zipWithIndex(R target)

Redeclares org.eclipse.collections.api.RichIterable.zipWithIndex.

Same as zipWithIndex() but uses target for output.

Inherited from org.eclipse.collections.api.RichIterable:
aggregateByaggregateByaggregateInPlaceByallSatisfyallSatisfyWithanySatisfyanySatisfyWithappendStringappendStringappendStringasLazychunkcollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcontainscontainsAllcontainsAllArgumentscontainsAllIterablecontainsAnycontainsAnyIterablecontainsBycontainsNonecontainsNoneIterablecountcountBycountBycountByEachcountByEachcountByWithcountByWithcountWithdetectdetectIfNonedetectOptionaldetectWithdetectWithIfNonedetectWithOptionaleachflatCollectflatCollectBooleanflatCollectByteflatCollectCharflatCollectDoubleflatCollectFloatflatCollectIntflatCollectLongflatCollectShortflatCollectWithforEachgetAnygetOnlygroupBygroupByAndCollectgroupByEachgroupByUniqueKeygroupByUniqueKeyinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoDoubleinjectIntoFloatinjectIntoIntinjectIntoLongintoisEmptymakeStringmakeStringmakeStringmakeStringmaxmaxBymaxByOptionalmaxOptionalmaxOptionalminminByminByOptionalminOptionalminOptionalnoneSatisfynoneSatisfyWithnotEmptyreducereduceByreduceByreduceInPlacereduceInPlacerejectrejectWithselectselectWithsizesumByDoublesumByFloatsumByIntsumByLongsummarizeDoublesummarizeFloatsummarizeIntsummarizeLongsumOfDoublesumOfFloatsumOfIntsumOfLongtoArraytoArraytoBagtoBiMaptoImmutableBagtoImmutableBiMaptoImmutableListtoImmutableMaptoImmutableSettoImmutableSortedBagtoImmutableSortedBagtoImmutableSortedBagBytoImmutableSortedListtoImmutableSortedListtoImmutableSortedListBytoImmutableSortedSettoImmutableSortedSettoImmutableSortedSetBytoListtoMaptoMaptoSettoSortedBagtoSortedBagtoSortedBagBytoSortedListtoSortedListtoSortedListBytoSortedMaptoSortedMaptoSortedMapBytoSortedSettoSortedSettoSortedSetBytoString