1.

How Will You Get The Lowest Number Present In A List Using Java 8?

Answer»

Following code will PRINT the highest NUMBER present in a list.

List NUMBERS = Arrays.asList(3, 2, 2, 3, 7, 3, 5);
IntSummaryStatistics stats = integers.stream().mapToInt((X) −> x).summaryStatistics();
System.out.println("Lowest number in List : " + stats.getMin());

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

List numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);
IntSummaryStatistics stats = integers.stream().mapToInt((x) −> x).summaryStatistics();
System.out.println("Lowest number in List : " + stats.getMin());



Discussion

No Comment Found