OnJava8-Examples/generics/ListMaker.java

11 lines
287 B
Java
Raw Normal View History

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