SyntaxFix
Write A Post
Hire A Developer
Questions
You can use collect method to add list of integers.
List<Integer> list = Arrays.asList(2, 4, 5, 6); int sum = list.stream().collect(Collectors.summingInt(Integer::intValue));