How can I sum every element in a list of lists using Java 8 stream?
For example, I have 3 different lists in a list and I am trying to sum every element in each list and create another List. I am new to Java 8 and trying to solve some questions using Stream API:
List<List<Integer>> cases = Arrays.asList(
Arrays.asList(1, 1, 2),
Arrays.asList(3, 3, 2),
Arrays.asList(4, 5, 1));
The output that I am trying to achieve:
{[4,8,10]}