head property

Option<T> head

Returns the first element as an Option. If the list is empty, it will return None.

Implementation

Option<T> get head {
  final iterator = this.iterator;
  if (iterator.moveNext()) return some(iterator.current);
  return kNone;
}