Java

Generics - Wildcards in Parameters

techbard 2016. 7. 12. 20:55
반응형



# Wildcards in Parameters


- <?>                     - unknown type

- <? extends Customer>    - any type that extends Customer

- <? super Customer>      - any type that's super class of Customer


private static void processData(ArrayList<? extends Customer> customers) {

for (Customer c : customers) {

c.doSomething();

}

}


반응형