About Question enthuware.ocpjp.v8.2.1738 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Martyjee
Posts: 32
Joined: Tue Oct 06, 2015 9:06 am
Contact:

About Question enthuware.ocpjp.v8.2.1738 :

Post 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!

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are correct. Fixed.
thank you for your feedback!

Ad9999
Posts: 15
Joined: Fri May 15, 2015 12:06 am
Contact:

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

Post by Ad9999 »

Good question, really clarified with a reduction operation is for me. :D

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests