News

Sorting can be a little trickier when it comes to sorting strings. Using the "Comparable" interface, Java programmers can extend alphabetizing capabilities to most any object.
If you want to take advantage of sorting methods in Java, you'll need to implement the Comparable interface.
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.