minOfWith<R> method
Returns the smallest value according to the provided comparator
among
all values produced by selector
function applied to each element in the
collection.
Implementation
R minOfWith<R>(Comparator<R> comparator, R Function(E element) selector) {
if (isEmpty) throw NoSuchElementException();
final iterator = this.iterator..moveNext();
var minValue = selector(iterator.current);
while (iterator.moveNext()) {
final value = selector(iterator.current);
if (comparator(minValue, value) > 0) minValue = value;
}
return minValue;
}