minBy<R extends Comparable> method
Returns the first entry yielding the smallest value of the given function or null
if there are no entries.
Implementation
MapEntry<K, V>? minBy<R extends Comparable>(
R Function(MapEntry<K, V>) selector,
) {
final i = entries.iterator;
if (!i.moveNext()) return null;
MapEntry<K, V> minElement = i.current;
R minValue = selector(minElement);
while (i.moveNext()) {
final e = i.current;
final v = selector(e);
if (minValue.compareTo(v) > 0) {
minElement = e;
minValue = v;
}
}
return minElement;
}