in Education by

List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);

Please log in or register to answer this question.

1 Answer

0 votes
by

List<Integer> numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);

IntSummaryStatistics stats = integers.stream().mapToInt((x) -> x).summaryStatistics();

System.out.println("Average of all numbers : " + stats.getAverage());

Related questions

0 votes
asked Mar 1, 2022 in Education by JackTerrance
0 votes
asked Nov 17, 2021 in Education by JackTerrance
0 votes
asked Aug 3, 2022 in Education by JackTerrance
...