Polymorphism
Providing a single interface to entities of different types.

Poly-Implements and Composition
How to compare a list of dog and find its biggest one? How about something else?

Built-in Comparable Interface
public interface Comparable<T> {
public int compareTo(T obj);
}
So we can use the existed libraries.
In fact, max() is ready for us in library called Collection.
(And avoid ugly castings.)
Comparator(HoFs)
From time to time, we maybe want to compare objects in different way.


The final codes:
Or, more like Java code:
import java.util.Comparator;
public class Dog implements Comparable<Dog> {
···
private static class NameComparator implements Comparator<Dog> {
···
}
public Comparator<Dog> getNameComparator() {
return new NameComparator();
}
···
}
···
Comparator<Dog> nc = Dog.getNameComparator();
···Callback
