vorige Folie ist nicht ganz die Wahrheit, weil man eventuell auch eine andere als die natürliche Ordnung benutzen möchte. Deswegen auch Konstruktor
TreeSet<E> ( Comparator<E> c );wobei
interface Comparator<E> { int compare (E x, E y); }
Benutzung z. B. mit anonymer Klasse
TreeSet<String> s = new TreeSet<String> (
new Comparator<String> {
int compare (String x, String y) {
return ...
}
});