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
-
- Iter<
T>
- Iter<
Methods
-
filterMap<
U> (U? f(T)) → Iter< U> -
Available on Iter<
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.T> , provided by the Iter$IterConcreteExtension extension -
find(
bool f(T)) → T? -
Available on Iter<
Searches for an element of an iterator that satisfies a predicate.T> , provided by the Iter$IterConcreteExtension extension -
findMap<
U> (U? f(T)) → U? -
Available on Iter<
Applies the function to the elements of iterator and returns the first non-(none/null) result.T> , provided by the Iter$IterConcreteExtension extension -
lastOrNull(
) → T? -
Available on Iter<
Consumes the iterator and returns the last element.T> , provided by the Iter$IterConcreteExtension extension -
mapWhile<
U> (U? f(T)) → Iter< U> -
Available on Iter<
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(_).T> , provided by the Iter$IterConcreteExtension extension -
maxBy(
int f(T, T)) → T? -
Available on Iter<
Returns the element that gives the maximum value with respect to the specified comparison function.T> , provided by the Iter$IterConcreteExtension extension -
maxByKey<
U extends Comparable< (U> >U f(T)) → T? -
Available on Iter<
Returns the element that gives the maximum value from the specified function.T> , provided by the Iter$IterConcreteExtension extension -
minBy(
int f(T, T)) → T? -
Available on Iter<
Returns the element that gives the minimum value with respect to the specified comparison function.T> , provided by the Iter$IterConcreteExtension extension -
minByKey<
U extends Comparable< (U> >U f(T)) → T? -
Available on Iter<
Returns the element that gives the minimum value from the specified function.T> , provided by the Iter$IterConcreteExtension extension -
next(
) → T? -
Available on Iter<
If the iterator is empty, returns null. Otherwise, returns the next value.T> , provided by the Iter$IterConcreteExtension extension -
nth(
int n) → T? -
Available on Iter<
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.T> , provided by the Iter$IterConcreteExtension extension -
position(
bool f(T)) → int? -
Available on Iter<
Searches for an element in an iterator, returning its index.T> , provided by the Iter$IterConcreteExtension extension -
rposition(
bool f(T)) → int? -
Available on Iter<
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.T> , provided by the Iter$IterConcreteExtension extension