Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers | ||||
| ||||
Ans. We are averaging elements of a collection by element1 grouped by element1 * list is the reference of collection * element1 is the member element returned by getElement1 method of ClassA * element2 is the member element returned by getElement2 method of ClassA | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
![]() list.stream().collect(Collectors.groupingBy(ClassA::getElement1, Collectors.averagingDouble(ClassA::getElement2))); | ||||
![]() | ||||
![]() | ||||