nl.knowledgeplaza.util
Class GenericsUtil

java.lang.Object
  extended by nl.knowledgeplaza.util.GenericsUtil

public class GenericsUtil
extends java.lang.Object

Constructors for easy generics: Map> m = newHashMap(); instead of: Map> m = new HashMap>(); This is also available Google Collections in http://code.google.com/p/google-collections/ Which will be moved to Guava sometime http://code.google.com/p/guava-libraries/

Author:
toeu

Constructor Summary
GenericsUtil()
           
 
Method Summary
static
<E> java.util.ArrayList<E>
newArrayList()
           
static
<K,V> java.util.HashMap<K,V>
newHashMap()
           
static
<K,V> java.util.Hashtable<K,V>
newHashtable()
           
static
<E> java.util.LinkedList<E>
newLinkedList()
           
static
<T> java.lang.ref.SoftReference<T>
newSoftReference(T t)
           
static
<K,V> java.util.TreeMap<K,V>
newTreeMap()
           
static
<E> java.util.Vector<E>
newVector()
           
static
<K,V> java.util.WeakHashMap<K,V>
newWeakHashMap()
           
static
<T> java.lang.ref.WeakReference<T>
newWeakReference(T t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericsUtil

public GenericsUtil()
Method Detail

newHashMap

public static <K,V> java.util.HashMap<K,V> newHashMap()
Type Parameters:
K -
V -
Returns:

newWeakHashMap

public static <K,V> java.util.WeakHashMap<K,V> newWeakHashMap()
Type Parameters:
K -
V -
Returns:

newTreeMap

public static <K,V> java.util.TreeMap<K,V> newTreeMap()
Type Parameters:
K -
V -
Returns:

newHashtable

public static <K,V> java.util.Hashtable<K,V> newHashtable()
Type Parameters:
K -
V -
Returns:

newArrayList

public static <E> java.util.ArrayList<E> newArrayList()
Type Parameters:
E -
Returns:

newLinkedList

public static <E> java.util.LinkedList<E> newLinkedList()
Type Parameters:
E -
Returns:

newVector

public static <E> java.util.Vector<E> newVector()
Type Parameters:
E -
Returns:

newWeakReference

public static <T> java.lang.ref.WeakReference<T> newWeakReference(T t)
Type Parameters:
T -
Parameters:
t -
Returns:

newSoftReference

public static <T> java.lang.ref.SoftReference<T> newSoftReference(T t)
Type Parameters:
T -
Parameters:
t -
Returns:


Copyright © 2010. All Rights Reserved.