min method

Option<T> min()

Returns the minimum element of an iterator.

Implementation

Option<T> min() {
  if (!moveNext()) {
    return None;
  }
  var min = current;
  while (moveNext()) {
    if (current.compareTo(min) < 0) {
      min = current;
    }
  }
  return Some(min);
}