User Tools

Site Tools


java_generics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
java_generics [2017/01/02 16:16]
178.237.8.52 [Unbound wildcards]
java_generics [2017/01/02 16:17] (current)
178.237.8.52 [Upper-bound wildcards]
Line 63: Line 63:
 Creates an instance of a ''​List''​ of **any kind**. An ''​ArrayList''​ of ''​String>''​ will be ok, for instance. ​ Creates an instance of a ''​List''​ of **any kind**. An ''​ArrayList''​ of ''​String>''​ will be ok, for instance. ​
 ==== Upper-bound wildcards ==== ==== Upper-bound wildcards ====
 +
 +Upper bound wildcards are used when you want to accept an **instance of a class or any of its derivatives**
 +
 +<code java>
 +List<? extends Exception>​ list = new ArrayList<​IOException>​();​
 +</​code>​
 ==== Lower-bound wildcards ==== ==== Lower-bound wildcards ====
java_generics.txt ยท Last modified: 2017/01/02 16:17 by 178.237.8.52