Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public class TestComparator {
public static void main(String args[]){
Person p1 = new Person("Meric",25);
Person p2 = new Person("Ali",15);
Person older = older(p1,p2, new PersonComparator());
System.out.println("Yasi buyuk olan person :" + older.isim); // Meric
}
public static Person older(Person p1, Person p2, PersonComparator c){
return c.compare(p1,p2) > 0 ? p1 : p2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment