max<T extends Comparable<Object>> function

T max<T extends Comparable<Object>>(
  1. T a,
  2. T b
)

Returns the greater of two Comparable objects.

For num values, behaves identically to math.max.

If the arguments compare equal, then it is unspecified which of the two arguments is returned.

Implementation

T max<T extends Comparable<Object>>(T a, T b) {
  if (a is num) {
    return math.max(a, b as num) as T;
  }
  return (a >= b) ? a : b;
}