listGetMaxValue<T extends num> static method

T? listGetMaxValue<T extends num>(
  1. List<T> array
)

Implementation

static T? listGetMaxValue<T extends num>(List<T> array) {
  if (array.isEmpty) return null; // return -99999999;

  T max = array[0];

  for (int i = 1, l = array.length; i < l; ++i) {
    if (array[i] > max) max = array[i];
  }

  return max;
}