You are viewing a single comment's thread. Return to all comments →
java 8
public static void main(String[] args) { List<Object> list = new ArrayList<>(); for(int i=1; i<=3; i++){ list.add(i); } list.add("Hello"); list.add("World"); list.stream().forEach(System.out::println); }
Java 7
class Printer { <T> void printArray(T [] array){ for(T element : array){ System.out.println(element); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Generics
You are viewing a single comment's thread. Return to all comments →
java 8
Java 7