OnJava8-Examples/generics/ListOfGenerics.java
2015-05-05 11:20:13 -07:00

9 lines
242 B
Java

//: generics/ListOfGenerics.java
import java.util.*;
public class ListOfGenerics<T> {
private List<T> array = new ArrayList<>();
public void add(T item) { array.add(item); }
public T get(int index) { return array.get(index); }
} ///:~