maxWith method
Returns the first entry having the largest value according
to the provided comparator
or null
if there are no entries.
Implementation
MapEntry<D, S>? maxWith(Comparator<MapEntry<D, S>> comparator) {
final i = isMapEmpty().entries.iterator;
if (!i.moveNext()) return null;
var max = i.current;
while (i.moveNext()) {
final e = i.current;
if (comparator(max, e) < 0) {
max = e;
}
}
return max;
}