peek method

Option<T> peek()

Returns the next element of the iterator without consuming it.

Implementation

Option<T> peek() {
  // print("peek");
  if (_hasPeaked) {
    return Some(_peeked);
  }
  if (_iterator.moveNext()) {
    _peeked = _iterator.current;
    _hasPeaked = true;
    return Some(_peeked);
  }
  return None;
}