Well, probably I formulated it not so clearly. I'd like to have the following additions:public interface Comparator<T> { ... default T max(T a, T b) { return compare(a, b) > 0 ? a : b; } default T min(T a, T b) { return compare(a, b) > 0 ? b : a; } static <T extends Comparable<T>> T max(T a, T b) { return a.compareTo(b) > 0 ? a : b; } static <T extends Comparable<T>> T min(T a, T b) { return a.compareTo(b) > 0 ? b : a; } }
Let's separate these. I think the first two have a good claim to be in Comparator; I think the latter two probably live better in Comparable, which feels like a separate conversation (and maybe less important?) (And also, there's some overlap with some yet-uncollapsed stuff going on in Valhalla that I'd like to steer clear of.)
