泛型是一种表示类或方法行为对于未知类型的类型约束的方法,比如 “不管这个方法的参数 x 和 y 是哪种类型,它们必须是相同的类型”,“必须为这些方法提供同一类型的参数” 或者 “foo() 的返回值和bar() 的参数是同一类型的”。虽然 String 是 Object 的子类,但是 List<String> 和 List<Object> 之间并没有什么关系——List<String> 不是 List<Object> 的子类或者子类型。
Wildcards
Consider the problem of writing a routine that prints out all the elements in a collection. Here’s how you might write it in an older version of the language (i.e., a pre-5.0 release):
void printCollection(Collection c) { [...]
