Skip to content

Commit

Permalink
Remove duplication in ComparatorCompat thenComparing
Browse files Browse the repository at this point in the history
  • Loading branch information
aNNiMON committed Mar 22, 2019
1 parent 22df050 commit 43828f3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions stream/src/main/java/com/annimon/stream/ComparatorCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,7 @@ public ComparatorCompat<T> reversed() {
*/
@NotNull
public ComparatorCompat<T> thenComparing(@NotNull final Comparator<? super T> other) {
Objects.requireNonNull(other);
return new ComparatorCompat<T>(new Comparator<T>() {

@Override
public int compare(T t1, T t2) {
final int result = comparator.compare(t1, t2);
return (result != 0) ? result : other.compare(t1, t2);
}
});
return new ComparatorCompat<T>(thenComparing(comparator, other));
}

/**
Expand Down

0 comments on commit 43828f3

Please sign in to comment.