C is correct:
for obtain the same result by collector can use:
double averageSalary = roster.stream()
.collect(Collectors.averagingInt(Employee::getSalary));
but is int average
"for obtain the same result by collector can use:
double averageSalary = roster.stream()
.collect(Collectors.averagingInt(Employee::getSalary));"
this is for all employees
it has to be just for "Bay Area"
answer : C
The main operations in a Stream pipeline and the order in which they occur are :
filter
sorted
map
collect
So, there are C and D after that.
There is no such method as average() in Stream class.
IntStream :
OptionalDouble avarage()
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
d7bb0b2
8 months, 1 week agoASPushkin
7 months agoASPushkin
8 months, 2 weeks ago