What is the meaning of the <?> token in Java?

前端 未结 8 1799
囚心锁ツ
囚心锁ツ 2020-12-18 01:47

What is the meaning of the token in this code copied from www.JavaPractices.com? When I replace it with the more conventional looking

8条回答
  •  离开以前
    2020-12-18 02:07

    This is an example of using wildcard in a type argument. i.e. a generic type. A wildcard parameterized type is an instantiation of a generic type where at least one type argument is a wildcard. Examples of wildcard parameterized types are Collection , List , Comparator and Pair .

    A wildcard parameterized type denotes a family of types comprising concrete instantiations of a generic type. The kind of the wildcard being used determines which concrete parameterized types belong to the family.

提交回复
热议问题