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();
  while (i.hasNext()) {
    final T e = i.next();
    if (Comparable.compare(min, e) > 0) {
      min = e;
    }
  }
  return min;
}