For a variable, the NavigableSet<?>compiler only knows that it is a NavigableSet, but does not know this type, so you cannot add any objects.
For example, it could be a code:
NavigableSet<?> set = new TreeSet<String>();
set.add(new Object());
source
share