minOrNull method

T? minOrNull()

Returns the smallest element or null if there are no elements.

Implementation

T? minOrNull() {
  final i = iterator();
  if (!iterator().hasNext()) return null;
  T min = i.next();
  if (min.isNaN) return min;
  while (i.hasNext()) {
    final T e = i.next();
    if (e.isNaN) return e;
    if (min > e) {
      min = e;
    }
  }
  return min;
}