headOption property

Option<A> get headOption
inherited

Returns the first element of this collection as a Some if non-empty. If this collction is empty, None is returned.

Implementation

Option<A> get headOption {
  final it = iterator;
  return Option.when(() => it.hasNext, () => it.next());
}