I found in the util.TreeSet class that one of the constructor is calling another constructor with a new TreeMap with empty generic type.
public TreeSet(Comparator<? super E> comparator) {
this(new TreeMap<>(comparator));
}
What does new TreeMap<> mean ? is that equivalent to new TreeMap<?> ?
This is Java 7 syntax. The diamond (
<>) is a short-hand to ask the Java compiler to fill generic arguments with whatever makes sense in the local context (in this case, it’ll be? super E).