## edu.stanford.nlp.util
Class Generics

    java.lang.Object
      edu.stanford.nlp.util.Generics

    public class Generics

extends Object

A collection of utilities to make dealing with Java generics less painful and verbose. For example, rather than declaring

     Map<String, List<Pair<IndexedWord, GrammaticalRelation>>> = new HashMap<String, List<Pair<IndexedWord, GrammaticalRelation>>>()

you just call `Generics.newHashMap()`:

     Map<String, List<Pair<IndexedWord, GrammaticalRelation>>> = Generics.newHashMap()

Java type-inference will almost always just do the right thing (every once in a while, the compiler will get confused before you do, so you might still occasionally have to specify the appropriate types). This class is based on the examples in Brian Goetz's article Java theory and practice: The pseudo-typedef antipattern.

Author:
  Ilya Sherman

Method Summary

`static

`<E> ArrayList<E>`

`

`newArrayList()`

`static

`<E> ArrayList<E>`

`

`newArrayList(Collection<? extends E> c)`

`static

`<E> ArrayList<E>`

`

`newArrayList(int size)`

`static

`<E> BinaryHeapPriorityQueue<E>`

`

`newBinaryHeapPriorityQueue()`

`static

`<K,V> ConcurrentHashMap<K,V>`

`

`newConcurrentHashMap()`

`static

`<K,V> ConcurrentHashMap<K,V>`

`

`newConcurrentHashMap(int initialCapacity)`

`static

`<K,V> ConcurrentHashMap<K,V>`

`

`newConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)`

`static

`<K,V> HashMap<K,V>`

`

`newHashMap()`

`static

`<K,V> HashMap<K,V>`

`

`newHashMap(int initialCapacity)`

`static

`<K,V> HashMap<K,V>`

`

`newHashMap(Map<? extends K,? extends V> m)`

`static

`<E> HashSet<E>`

`

`newHashSet()`

`static

`<E> HashSet<E>`

`

`newHashSet(Collection<? extends E> c)`

`static

`<E> HashSet<E>`

`

`newHashSet(int initialCapacity)`

`static

`<E> Index<E>`

`

`newIndex()`

`static

`<T> Interner<T>`

`

`newInterner()`

`static

`<E> LinkedList<E>`

`

`newLinkedList()`

`static

`<E> LinkedList<E>`

`

`newLinkedList(Collection<? extends E> c)`

`static

`<T1,T2> Pair<T1,T2>`

`

`newPair(T1 first, T2 second)`

`static

`<E> Stack<E>`

`

`newStack()`

`static

`<T> SynchronizedInterner<T>`

`

`newSynchronizedInterner(Interner<T> interner)`

`static

`<T> SynchronizedInterner<T>`

`

`newSynchronizedInterner(Interner<T> interner, Object mutex)`

`static

`<K,V> TreeMap<K,V>`

`

`newTreeMap()`

`static

`<E> TreeSet<E>`

`

`newTreeSet()`

`static

`<E> TreeSet<E>`

`

`newTreeSet(Comparator<? super E> comparator)`

`static

`<E> TreeSet<E>`

`

`newTreeSet(SortedSet<E> s)`

`static

`<T1,T2,T3> Triple<T1,T2,T3>`

`

`newTriple(T1 first, T2 second, T3 third)`

`static

`<K,V> WeakHashMap<K,V>`

`

`newWeakHashMap()`

`static

`<T> WeakReference<T>`

`

`newWeakReference(T referent)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### newArrayList

    public static <E> ArrayList<E> newArrayList()

### newArrayList

    public static <E> ArrayList<E> newArrayList(int size)

### newArrayList

    public static <E> ArrayList<E> newArrayList(Collection<? extends E> c)

### newLinkedList

    public static <E> LinkedList<E> newLinkedList()

### newLinkedList

    public static <E> LinkedList<E> newLinkedList(Collection<? extends E> c)

### newHashSet

    public static <E> HashSet<E> newHashSet()

### newHashSet

    public static <E> HashSet<E> newHashSet(int initialCapacity)

### newHashSet

    public static <E> HashSet<E> newHashSet(Collection<? extends E> c)

### newTreeSet

    public static <E> TreeSet<E> newTreeSet()

### newTreeSet

    public static <E> TreeSet<E> newTreeSet(Comparator<? super E> comparator)

### newTreeSet

    public static <E> TreeSet<E> newTreeSet(SortedSet<E> s)

### newStack

    public static <E> Stack<E> newStack()

### newBinaryHeapPriorityQueue

    public static <E> BinaryHeapPriorityQueue<E> newBinaryHeapPriorityQueue()

### newHashMap

    public static <K,V> HashMap<K,V> newHashMap()

### newHashMap

    public static <K,V> HashMap<K,V> newHashMap(int initialCapacity)

### newHashMap

    public static <K,V> HashMap<K,V> newHashMap(Map<? extends K,? extends V> m)

### newWeakHashMap

    public static <K,V> WeakHashMap<K,V> newWeakHashMap()

### newConcurrentHashMap

    public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap()

### newConcurrentHashMap

    public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity)

### newConcurrentHashMap

    public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity,
                                                                    float loadFactor,
                                                                    int concurrencyLevel)

### newTreeMap

    public static <K,V> TreeMap<K,V> newTreeMap()

### newIndex

    public static <E> Index<E> newIndex()

### newPair

    public static <T1,T2> Pair<T1,T2> newPair(T1 first,
                                              T2 second)

### newTriple

    public static <T1,T2,T3> Triple<T1,T2,T3> newTriple(T1 first,
                                                        T2 second,
                                                        T3 third)

### newInterner

    public static <T> Interner<T> newInterner()

### newSynchronizedInterner

    public static <T> SynchronizedInterner<T> newSynchronizedInterner(Interner<T> interner)

### newSynchronizedInterner

    public static <T> SynchronizedInterner<T> newSynchronizedInterner(Interner<T> interner,
                                                                      Object mutex)

### newWeakReference

    public static <T> WeakReference<T> newWeakReference(T referent)

Stanford NLP Group