bounded-wildcard

Java Generics (Wildcards)

和自甴很熟 提交于 2019-11-25 23:34:13
问题 I have a couple of questions about generic wildcards in Java: What is the difference between List<? extends T> and List<? super T> ? What is a bounded wildcard and what is an unbounded wildcard? 回答1: In your first question, <? extends T> and <? super T> are examples of bounded wildcards. An unbounded wildcard looks like <?> , and basically means <? extends Object> . It loosely means the generic can be any type. A bounded wildcard ( <? extends T> or <? super T> ) places a restriction on the