I am refreshing my knowledge on Java generics. So I turned to the excellent tutorial from Oracle ... and started to put together a presentation for my coworkers. I came acro
Technically, there is no difference between
void printObjects(List list) {
and
void printList(List> list) {
On the other hand, if you use it more than once, the difference becomes significant. e.g.
void printObjectsExceptOne(List list, E object) {
is completely different than
void printObjects(List> list, Object object) {
You might see that first case enforces both types to be same. While there is no restriction in second case.
As a result, if you are going to use a type parameter only once, it does not even make sense to name it. That is why java architects invented so called wildcard arguments (most probably).
Wildcard parameters avoid unnecessary code bloat and make code more readable. If you need two, you have to fall back to regular syntax for type parameters.
Hope this helps.