The following code:
Set<? extends Integer> set = new HashSet<>();
Compiles fine. However, the essence of using the diamond notation is just for not rewriting the LHS type parameter again. This means that the statement above should be equivalent with the following:
Set<? extends Integer> set = new HashSet<? extends Integer>();
But as it turns out, it's not. I guess it's rational since the compiler doesn't know the object's type parameter since it's the wildcard ('?'). When not using bounded type parameters, everything works fine so I supposed the same would apply for any case. But why allow the syntax anyway? What is, in the end, the type parameter of the first statement?
Thanks