Just trying to be precise, so feel free to ignore. It is the method will take any List that accepts a particular type that is string or subclasses string. It is not the list that accepts any type, the list accepts a specific type.
Now, of course, this example is somewhat silly. Since the String class is final, there are no classes that subclasses string; And the compiler is not smart enough to flag this.
Henry Wong wrote:Now, of course, this example is somewhat silly.
Somewhat. I think they may be intentionally using the <? extends X> idiom to signal that the list is not intended to be modified, only read. This discourages (though it does not necessarily prevent) people from modifying the List. Not very elegant, but some people do use it this way.