Fancy generics capture collision

后端 未结 5 1289
星月不相逢
星月不相逢 2021-01-05 07:19

Please give me a hint as to what is going on here:

List a = new ArrayList();
List b = new Array         


        
5条回答
  •  [愿得一人]
    2021-01-05 08:02

    PECS (producer-extends, consumer-super)

    • You cannot put anything into a type declared with an EXTENDS wildcard except for the value null, which belongs to every reference type
    • You cannot get anything out from a type declared with an SUPER wildcard except for a value of type Object, which is a super type of every reference type

提交回复
热议问题