How to sort objects in java using Comparator?
In the below example class Student has three fields
Name, Age & Mark
Now i am showing 2 types of sorting here
- by Name
- by Mark
Comparator is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. This interface is a member of the Java Collections Framework.

Comments
Post a Comment
Ask me anything here...