in Education by
How will you get the highest number present in a list using Java 8

1 Answer

0 votes
by

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());

Related questions

0 votes
    How will you get the sum of all numbers present in a list using Java 8 in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you sort a list of string using Java 8 lambda expression?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print 10 random numbers using forEach of java 8 ?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How do you find the number with the highest value of x and y? (a) ceil(x,y) (b) top(x ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 21, 2021 in Education by JackTerrance
0 votes
    How will you print 10 random numbers in a sorted order in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print 10 random numbers in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print count of empty strings in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    How will you print unique squares of numbers in Java 8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    I have function of "endgame" and here's how the function goes function endgame() { setScreen("scorescreen" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    How will you get the index of an object in a list?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    How will you get the index of an object in a list?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    How will you get the min valued item of a list in Python?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    How will you get the max valued item of a list Python?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    How will you get the length of a list in Python?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    How will you check if an element is present in a vector? (a) Match() (b) Dismatch() (c) Mismatch() ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
...