Generics - Using Type Wildcards


/ Published in: Java
Save to your folder(s)

Uwaga: taki typ generyczny jest niestety readonly.


Copy this code and paste it in your HTML
  1. public void printList(List<?> list, PrintStream out) throws IOException {
  2.  
  3. for (Iterator<?> i = list.iterator( ); i.hasNext( ); ) {
  4.  
  5. out.println(i.next( ).toString( ));
  6.  
  7. }
  8.  
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.