The Arrays class
contain methods for searching or sorting collections of objects
that implement the Comparable interface
Comparable
interface
public interface Comparable
{
int compareTo(Object otherObject);
}
The call a.compareTo(b)
- Returns a negative number is a should come before
b
- Returns 0 if a and b are the same
- Returns a positive number otherwise