fork download
  1. import java.util.List;
  2. import java.util.stream.Collectors;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. List<List<Integer>> cases = List.of(List.of(1, 1, 2), List.of(3, 3, 2), List.of(4, 5, 1));
  7. List<Integer> result = cases.stream()
  8. .map(e -> e.stream().reduce(0, Integer::sum))
  9. .collect(Collectors.toList());
  10. System.out.println(result);
  11. }
  12. }
Success #stdin #stdout 0.08s 48416KB
stdin
Standard input is empty
stdout
[4, 8, 10]