max method

int? max(
  1. int selector(
    1. T
    )
)

Implementation

int? max(int Function(T) selector) {
  if (isEmpty) {
    return null;
  }

  return skip(1)
      .fold(selector(first), (prev, next) => math.max(prev!, selector(next)));
}