//: net/mindview/util/New.java // Utilities to simplify generic container creation // by using type argument inference. package net.mindview.util; import java.util.*; public class New { public static Map map() { return new HashMap(); } public static List list() { return new ArrayList(); } public static LinkedList lList() { return new LinkedList(); } public static Set set() { return new HashSet(); } public static Queue queue() { return new LinkedList(); } // Examples: public static void main(String[] args) { Map> sls = New.map(); List ls = New.list(); LinkedList lls = New.lList(); Set ss = New.set(); Queue qs = New.queue(); } } ///:~