상세 컨텐츠

본문 제목

Generics - Wildcards in Parameters

Java

by 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();

}

}


반응형

관련글 더보기

댓글 영역