Java Reference
In-Depth Information
processValue(names[i], value);
}
}
Where
?
on its own is the
unbounded wildcard,
that can represent any
type, "
?extends X
" is a
bounded wildcard:
It can only represent the type
X
or any type that extends or implements
X
(depending on whether
X
is
a class or interface). This time in
processValues
we know that, at worst,
table.find
will return a
Number
, so we can store that return value in a
variable of type
Number
.
There is a lot more to generic types and you'll learn about their full
power in
Chapter 11
.
Meanwhile, you know enough about them to un-
derstand the simple usages that will occur in the early chapters of this
topic.