Iter$IterConcreteExtension<T extends Object> extension

Methods only implemented when T is a concrete type (non-nullable). Why: Correctness of code and reduces bugs. e.g. if nth returns null on a nullable iterable, the nth element is either null or the iterable does not have n elements. While if it returns Option, if the element is null it returns Some(null) and if it does not have n elements it returns None

on

Methods

filterMap<U>(U? f(T)) Iter<U>

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Creates an iterator that both filters and maps. The returned iterator yields only the values for which the supplied closure returns a non-null value.
find(bool f(T)) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Searches for an element of an iterator that satisfies a predicate.
findMap<U>(U? f(T)) → U?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Applies the function to the elements of iterator and returns the first non-(none/null) result.
lastOrNull() → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Consumes the iterator and returns the last element.
mapWhile<U>(U? f(T)) Iter<U>

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Creates an iterator that both yields elements based on a predicate and maps. It will call this closure on each element of the iterator, and yield elements while it returns Some(_).
maxBy(int f(T, T)) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Returns the element that gives the maximum value with respect to the specified comparison function.
maxByKey<U extends Comparable<U>>(U f(T)) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Returns the element that gives the maximum value from the specified function.
minBy(int f(T, T)) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Returns the element that gives the minimum value with respect to the specified comparison function.
minByKey<U extends Comparable<U>>(U f(T)) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Returns the element that gives the minimum value from the specified function.
next() → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

If the iterator is empty, returns null. Otherwise, returns the next value.
nth(int n) → T?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Returns the nth element of the iterator. Like most indexing operations, the count starts from zero, so nth(0) returns the first value, nth(1) the second, and so on. nth() will return None if n is greater than or equal to the length of the iterator.
position(bool f(T)) int?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Searches for an element in an iterator, returning its index.
rposition(bool f(T)) int?

Available on Iter<T>, provided by the Iter$IterConcreteExtension extension

Searches for an element in an iterator from the right, returning its index. Recommended to use with a list, as it is more efficient, otherwise use positionOpt.