News

Listing 2 imports the java.util.Comparator functional interface, which describes a function that can perform a comparison on two objects of arbitrary but identical type.
Java interfaces are different from classes, ... An example of a default method in Java’s standard class library is java.util.Comparator<T>‘s default Comparator<T> reversed() method.
If you want to take advantage of sorting methods in Java, you'll need to implement the Comparable interface. Written by David Petersheim, Contributor Feb. 17, 2005 at 8:00 a.m. PT ...