티스토리 뷰

Java

Generics - Wildcards in Parameters

techbard 2016.07.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();

}

}


댓글
댓글쓰기 폼
공지사항
Total
394,932
Today
3
Yesterday
28
«   2018/11   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
글 보관함