SE450
:
The Comparable Interface Type
[14/41]
Collections
has static
sort
method:
ArrayList<E> a = . . .
Collections.sort(a);
Objects in list must implement the
Comparable
interface type
public interface Comparable<T>
{
int compareTo(T other);
}
Interface is parameterized (like
ArrayList
)
Type parameter is type of
other