OptionalIterableExtension<T> extension
Extensions that apply to all iterables.
- on
-
- Iterable<
T>
- Iterable<
Properties
-
firstOptional
→ Optional<
T> -
The first element, or
Optional.empty()
if the iterable is empty.no setter -
lastOptional
→ Optional<
T> -
The last element, or
Optional.empty()
if the iterable is empty.no setter -
singleOptional
→ Optional<
T> -
The single element of the iterable, or
Optional.empty()
.no setter
Methods
-
firstWhereIndexedOptional(
bool test(int index, T element)) → Optional< T> -
The first element whose value and index satisfies
test
. -
firstWhereOptional(
bool test(T element)) → Optional< T> -
The first element satisfying
test
, orOptional.empty()
if there are none. -
lastWhereIndexedOptional(
bool test(int index, T element)) → Optional< T> -
The last element whose index and value satisfies
test
. -
lastWhereOptional(
bool test(T element)) → Optional< T> -
The last element satisfying
test
, orOptional.empty()
if there are none. -
singleWhereIndexedOptional(
bool test(int index, T element)) → Optional< T> -
The single element satisfying
test
. -
singleWhereOptional(
bool test(T element)) → Optional< T> -
The single element satisfying
test
.