IterableExt<E> extension

Extensions to Iterables

on

Properties

nonNull Iterable<E>
Returns a new lazy Iterable with all non-null elements, or an empty iterable if the receiver is null.
no setter

Methods

all(Predicate<E> test) bool
Returns true if all elements match the given predicate test.
asList() List<E>
Creates a fixed-length List containing the elements of this Iterable, equivalent to toList(growable: false).
averageBy<T extends num>(T selector(int index, E)) double
Returns an average of all values produced by selector function or double.nan if there are no elements.
chunked(int size) Iterable<Iterable<E>>
Return a new lazy iterable contains chunks of this collection each not exceeding the given size.
flatMap<T>(Transform<E, Iterable<T>> f) Iterable<T>
Return a new lazy Iterable of all elements yielded from results of transform f function being invoked on each element of original collection.
flatMapIndexed<T>(IndexedTransform<E, Iterable<T>> f) Iterable<T>
Return a new lazy Iterable of all elements yielded from results of transform f function being invoked on each element of original collection, providing sequential index of each element.
flatMapToList<T>(List<T> destination, Transform<E, Iterable<T>> f) List<T>
Appends to the give destination with the elements yielded from results of transform f function being invoked on each element of original collection.
flatMapToListIndexed<T>(List<T> destination, IndexedTransform<E, Iterable<T>> f) List<T>
Appends to the give destination with the elements yielded from results of transform f function being invoked on each element of original collection, providing sequential index of each element.
flatMapToSet<T>(Set<T> destination, Transform<E, Iterable<T>> f) Set<T>
Appends to the give destination with the elements yielded from results of transform f function being invoked on each element of original collection.
flatMapToSetIndexed<T>(Set<T> destination, IndexedTransform<E, Iterable<T>> f) Set<T>
Appends to the give destination with the elements yielded from results of transform f function being invoked on each element of original collection, providing sequential index of each element.
foldIndexed<S>(S initial, IndexedAccumulate<S, E> f) → S
Accumulates a collection to a single value of type S, which starts from an initial value, by combining each element with the current accumulator value, with the combinator f, providing sequential index of the element.
foldRight<S>(S initial, ReversedAccumulate<S, E> f) → S
Accumulates a collection to a single value of type S, which starts from an initial value, by combining each element with the current accumulator value, with the combinator f in a reversed order.
foldRightIndexed<S>(S initial, IndexedReversedAccumulate<S, E> f) → S
Accumulates a collection to a single value, which starts from an initial value, by combining each element with the current accumulator value, with the combinator f in a reversed order, providing sequential index of the element.
forEachIndexed(IndexedAction<E> f) → void
Applies the action f on each element, providing sequential index of the element.
mapIndexed<T>(IndexedTransform<E, T> f) Iterable<T>
Transforms each element to another object of type T, by applying the transformer f, providing sequential index of the element.
mapToList<T>(List<T> destination, Transform<E, T> f) List<T>
Transforms elements to objects of type T with the transformer f, and appends the result to the given destination.
mapToListIndexed<T>(List<T> destination, IndexedTransform<E, T> f) List<T>
Transforms elements to objects of type T with the transformer f, providing sequential index of the element, and appends the result to the given destination.
mapToSet<T>(Set<T> destination, Transform<E, T> f) Set<T>
Transforms elements to objects of type T with the transformer f, and appends the result to the given destination.
mapToSetIndexed<T>(Set<T> destination, IndexedTransform<E, T> f) Set<T>
Transforms elements to objects of type T with the transformer f, providing sequential index of the element, and appends the result to the given destination.
maxBy<T extends Comparable<Object>>(T selector(int index, E)) → E?
Returns the first element yielding the largest value of the given function or null if there are no elements.
minBy<T extends Comparable<Object>>(T selector(int index, E)) → E?
Returns the first element yielding the smallest value of the given function or null if there are no elements.
none(Predicate<E> test) bool
Returns true if no elements match the given predicate test.
partition(Predicate<E> test) → Tuple2<Iterable<E>, Iterable<E>>
Splits this collection into pair (Tuple2) of lazy iterables, where item1 contains elements for which test yields true, while item2 contains elements for which test yields false.
partitionIndexed(IndexedPredicate<E> test) → Tuple2<Iterable<E>, Iterable<E>>
Splits this collection into pair (Tuple2) of lazy iterables, where item1 contains elements for which test yields true, while item2 contains elements for which test yields false, comparing to partition, test will has access to the sequential index of each element.
sumBy<T extends num>(T selector(int index, E)) → T
Returns the sum of all values produced by selector function applied to each element in the collection.
whereIndexed(IndexedPredicate<E> test) Iterable<E>
Returns a new lazy Iterable with all elements that satisfy the predicate test, providing sequential index of the element.
whereNot(Predicate<E> test) Iterable<E>
Returns a new lazy Iterable with all elements that does NOT satisfy the predicate test.
whereNotIndexed(IndexedPredicate<E> test) Iterable<E>
Returns a new lazy Iterable with all elements that does NOT satisfy the predicate test, providing sequential index of the element.