For example :
List<? extends HasWord> wordList = toke.tokenize();
? extends HasWord means "A class that extends HasWord
." In other words, HasWord
itself or any of its children... basically anything that would work with instanceof HasWord
.
In more technical terms, ? extends HasWord
is a bounded wildcard, covered in Item 28 of Effective Java 2nd Edition, starting on page 134. This is part of the chapter on Generics available online as a PDF.
A question mark is a signifier for 'any type'. ?
alone means Any type extending Object
(including Object
).
Map<String,?>
? is for ? extends Object.