src/share/classes/java/util/stream/ReferencePipeline.java

Print this page
rev 7485 : 8009736: Comparator API cleanup
Reviewed-by:
Contributed-by: henry.jen@oracle.com

@@ -23,11 +23,10 @@
  * questions.
  */
 package java.util.stream;
 
 import java.util.Comparator;
-import java.util.Comparators;
 import java.util.Iterator;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Spliterator;
 import java.util.Spliterators;

@@ -510,16 +509,16 @@
         return evaluate(ReduceOps.makeRef(resultFactory, accumulator, combiner));
     }
 
     @Override
     public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
-        return reduce(Comparators.greaterOf(comparator));
+        return reduce(BinaryOperator.maxBy(comparator));
     }
 
     @Override
     public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
-        return reduce(Comparators.lesserOf(comparator));
+        return reduce(BinaryOperator.minBy(comparator));
 
     }
 
     @Override
     public final long count() {