Usually when generic explanations say something like this:
List<?> list = new ArrayList<?>();
This code (above) throws an error because the compiler does not know what type to instantiate.
but
List<Set<?>> list = new ArrayList<Set<?>>();
this (above) compiles well
and this:
List<Set<?>> list = new ArrayList<Set<String>>();
not compiled.
I'm confusing.
Can you clarify the full right not to interfere in these things.
PS
I know that
List<Number> list = new ArrayList<Integer>();
will not compile, and I understand why.
user2684975
source
share