maxOrNull method

E? maxOrNull()

获取最大值

Implementation

E? maxOrNull() {
  final it = iterator;
  E? max;
  while (it.moveNext()) {
    if (max == null) {
      max = it.current;
    } else {
      final c = max.compareTo(it.current);
      max = c > 0 ? max : it.current;
    }
  }
  return max;
}