0
How will you get the highest number present in a list using Java 8 ?

Open 1 Answers 95 Views Education
How will you get the highest number present in a list using Java 8

1 Answer

0

Following code will print the highest number present in a list.

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

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

System.out.println("Highest number in List : " + stats.getMax());

by (54.6k points)
...