maxByOrNull<R extends Comparable<R> > method
T?
maxByOrNull<R extends Comparable<R> >(
- R by(
- T item
- T? ifNull
Implementation
T? maxByOrNull<R extends Comparable<R>>(R by(T item), [T? ifNull]) {
T? _max;
for (final t in this) {
if (_max == null || (by(t).compareTo(by(_max))) > 0) {
_max = t;
}
}
return _max ?? ifNull;
}