Java Generics: List, List<Object>, List<?>

后端 未结 12 2022
你的背包
你的背包 2020-11-22 17:08

Can someone explained, as detailed as possible, the differences between the following types?

List
List
List


Let me m

12条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 18:07

    To complement the tutorials mentioned by Rob, here's a wikibook explaining the topic:
    http://en.wikibooks.org/wiki/Java_Programming/Generics


    Edit:

    1. No restrictions on type of items in list

    2. Items in list must extend Object

    3. Wildcard used by itself, so it matches anything

    Would it be naive of me to conclude at this point that there's hardly any/no difference at all?

提交回复
热议问题