Skip to content

Commit

Permalink
Remove redundant null checks (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
vilisimo authored and cbracken committed May 28, 2019
1 parent dbb723d commit 1cc123f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/iterables/min_max.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ part of quiver.iterables;
T max<T>(Iterable<T> i, [Comparator<T> compare]) {
if (i.isEmpty) return null;
final Comparator<T> _compare = compare ?? Comparable.compare;
return i.isEmpty ? null : i.reduce((a, b) => _compare(a, b) > 0 ? a : b);
return i.reduce((a, b) => _compare(a, b) > 0 ? a : b);
}

/// Returns the minimum value in [i], according to the order specified by the
Expand All @@ -35,7 +35,7 @@ T max<T>(Iterable<T> i, [Comparator<T> compare]) {
T min<T>(Iterable<T> i, [Comparator<T> compare]) {
if (i.isEmpty) return null;
final Comparator<T> _compare = compare ?? Comparable.compare;
return i.isEmpty ? null : i.reduce((a, b) => _compare(a, b) < 0 ? a : b);
return i.reduce((a, b) => _compare(a, b) < 0 ? a : b);
}

/// Returns the minimum and maximum values in [i], according to the order
Expand Down

0 comments on commit 1cc123f

Please sign in to comment.