Java Generics are the most ambitious extension added to the Java programming
language since its advent in the mid '90ies. The basics of Java Generics,
namely generic and parameterized types, are fairly easy to comprehend.
Yet, the so-called wildcards, which can be used as type arguments of generic
types and lead to constructs such as
List<?>
or
Comparator<?
super T>
, are way more difficult to digest. Despite of the difficulties
they pop up in many places in Java 5.0, most prominently in the
java.util
package.
Even old fellows such as the
getClass()
method use wildcards these
days. In essence, generics and wildcards cannot be ignored in Java 5.0.
In this tutorial, we aim to explain wildcards in greater depth. What
do they mean? How are they used? Are they of value in practice or are they
an esoteric and acedemic exercise? Why do wildcard parameterized type behave
that suprisingly? What else need I know to understand and use wildcards
effectively?
The tutorial is for Java developers who have studied the widely available
generics tutorial and want to know more. The goal of this talk is not so
much to explain the type theory, which is the foundation of generics and
wildcards, but more to address practical issues in software development
using Java generics or migrating to Java generics. |