Page 1 of 1

About Question enthuware.ocpjp.v8.2.1738 :

Posted: Wed Oct 07, 2015 9:31 am
by Martyjee
The explanation contains the following:

This is a valid reduction operation but it is not in java.util.stream.Stream interface. min and max methods are available in specialized Stream interfaces such an IntStream, LongStream, and DoubleStream.

The method 'max' is available in the Stream interface, only it takes a Comparator as an argument. The API says:

Optional<T> max(Comparator<? super T> comparator)
Returns the maximum element of this stream according to the provided Comparator. This is a special case of a reduction.

So I would argue that both 'reduce' and 'max' should be selected as the answer!

Re: About Question enthuware.ocpjp.v8.2.1738 :

Posted: Wed Oct 07, 2015 10:54 am
by admin
You are correct. Fixed.
thank you for your feedback!

Re: About Question enthuware.ocpjp.v8.2.1738 :

Posted: Fri Oct 16, 2015 4:37 pm
by Ad9999
Good question, really clarified with a reduction operation is for me. :D