Adding java method reference

This commit is contained in:
NKaushik89
2019-06-04 20:19:06 +05:30
committed by GitHub
parent 0eaa4e724d
commit 3ce74252b4
3 changed files with 147 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
public class NameComparator {
public int compareNames(Student s1, Student s2){
return s1.getName().compareTo(s2.getName());
}
public Student compareMarks(Student s1,Student s2){
return s1.getMarks() > s2.getMarks() ? s1 : s2;
}
}