maxWith method
Returns the first entry having the largest value according to the provided comparator
or null
if there are no entries.
Implementation
MapEntry<K, V>? maxWith(Comparator<MapEntry<K, V>> comparator) {
final i = 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;
}