IteratorResultFuncExtension<T> extension

on

Methods

tryFind<E extends Object>(Result<bool, E> f(T)) Result<Option<T>, E>
Applies function to the elements of iterator and returns the first true result or the first error.
tryFold<U, E extends Object>(U initial, Result<U, E> f(U, T)) Result<U, E>
An iterator method that applies a function as long as it returns successfully, producing a single, final value.
tryForEach<E extends Object>(Result<(), E> f(T)) Result<(), E>
An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error.
tryReduce<E extends Object>(Result<T, E> f(T, T)) Result<Option<T>, E>
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately.