Page 1 of 1

About Question enthuware.ocpjp.v8.2.1738 :

Posted: Fri Jan 25, 2019 4:33 pm
by AungKNyar
The answer says reduce() and max().
Actually there are three answers right?
reduce()
max()
sum()

Why is sum() not included as the correct answer?

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

Posted: Fri Jan 25, 2019 10:29 pm
by admin
The following explanation is already given with this option:
This is a valid reduction operation but it is not in java.util.stream.Stream interface.
Methods to sum up the numbers in a stream are available in specialized Stream interfaces such an IntStream, LongStream, and DoubleStream.

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

Posted: Tue Feb 18, 2020 6:06 am
by bvrulez
admin wrote:
Fri Jan 25, 2019 10:29 pm
The following explanation is already given with this option:
This is a valid reduction operation but it is not in java.util.stream.Stream interface.
Methods to sum up the numbers in a stream are available in specialized Stream interfaces such an IntStream, LongStream, and DoubleStream.
This explanation does not show up in my review of the (wrongly) answered question. It just shows an explanation for "add": "There is no such method in Stream interface." Maybe this message is also related to "sum", but it just shows under "add".

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

Posted: Tue Feb 18, 2020 7:20 am
by admin
Please check your private message/email.