OptionalIterableExtension<T> extension

Extensions that apply to all iterables.

on

Properties

firstOptional Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The first element, or Optional.empty() if the iterable is empty.
no setter
lastOptional Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The last element, or Optional.empty() if the iterable is empty.
no setter
singleOptional Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The single element of the iterable, or Optional.empty().
no setter

Methods

firstWhereIndexedOptional(bool test(int index, T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The first element whose value and index satisfies test.
firstWhereOptional(bool test(T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The first element satisfying test, or Optional.empty() if there are none.
lastWhereIndexedOptional(bool test(int index, T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The last element whose index and value satisfies test.
lastWhereOptional(bool test(T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The last element satisfying test, or Optional.empty() if there are none.
singleWhereIndexedOptional(bool test(int index, T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The single element satisfying test.
singleWhereOptional(bool test(T element)) Optional<T>

Available on Iterable<T>, provided by the OptionalIterableExtension extension

The single element satisfying test.