OnJava8-Examples/generics/ListMaker.java

11 lines
294 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: generics/ListMaker.java
import java.util.*;
public class ListMaker<T> {
List<T> create() { return new ArrayList<T>(); }
public static void main(String[] args) {
ListMaker<String> stringMaker= new ListMaker<String>();
List<String> stringList = stringMaker.create();
}
} ///:~