averagingInt boxes its result as a Double regardless of the source type, since an average of whole numbers is not itself guaranteed to be whole.
List<Integer> scores = List.of(80, 90, 70, 100);
Double avg = scores.stream().collect(Collectors.averagingInt(Integer::intValue));
System.out.println("Average (always Double): " + avg);
System.out.println("Type: " + avg.getClass().getSimpleName());
Average (always Double): 85.0
Type: Double
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27