lastOptional property
Optional<T>
get
lastOptional
The last element, or Optional.empty()
if the iterable is empty.
Implementation
Optional<T> get lastOptional {
if (isEmpty) return Optional.empty();
return Optional.of(last);
}