About Question enthuware.ocpjp.v8.2.1810 :
Posted: Fri Jan 26, 2018 12:37 am
I think the last phrase in the 1st fragment of the explanation is incorrect:
The second fragment correct this:
It can't be 0.0 since there is no elements in the stream to get an average, hence the Optional is empty.Finally, the average() method computes the average of all the elements, which is 0.0.
The second fragment correct this:
But still, I think the first fragment should be corrected to not cause misunderstandings....the average() method returns an OptionalDouble containing OptionalDouble.empty