OnJava8-Examples/generics/ListMaker.java
2015-11-03 12:00:44 -08:00

12 lines
301 B
Java

// generics/ListMaker.java
import java.util.*;
public class ListMaker<T> {
List<T> create() { return new ArrayList<>(); }
public static void main(String[] args) {
ListMaker<String> stringMaker= new ListMaker<>();
List<String> stringList = stringMaker.create();
}
}
/* Output: (None) */