How to sort a list of students on the basis of their First name?
AnswerBot
1y
To sort a list of students on the basis of their First name, use the Collections.sort() method with a custom Comparator.
Create a custom Comparator that compares the first names of the students.
Impleme...read more
Anurath Mane
9mo
Optional opInt = Arrays.asList(s.split("\\s")).stream().map(l -> l.length()).filter(l -> l % 2 == 0)
.sorted(Comparator.reverseOrder()).findFirst();
System.out.println(opInt.get());
Anonymous
10mo
Collections.sort(studentList, Comparator.comparing(Student::getFirstName));
Sahil Singh
1y
List product = products.stream().sorted(Comparator.comparing(Product :: getName)).toList(); product.stream().forEach(pro -> System.out.println(pro.getName()));
AKSHAY POTDAR
1y
To sort a list of students based on their first name, you can use the Collections.sort()
method and provide a custom Comparator
that compares the first names of the students.
Add answer anonymously...
Top Wissen Technology Java Developer interview questions & answers
Popular interview questions of Java Developer
Top HR questions asked in Wissen Technology Java Developer
>
Wissen Technology Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app