Adding java method reference
This commit is contained in:
9
java-8/Java-method-reference/NameComparator.java
Normal file
9
java-8/Java-method-reference/NameComparator.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user