edu.stanford.nlp.util
Class CollectionFactory<T>

java.lang.Object
  extended by edu.stanford.nlp.util.CollectionFactory<T>
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CollectionFactory.ArrayListFactory, CollectionFactory.HashSetFactory, CollectionFactory.LinkedListFactory, CollectionFactory.SizedArrayListFactory, CollectionFactory.TreeSetFactory

public abstract class CollectionFactory<T>
extends java.lang.Object
implements java.io.Serializable

Factory for vending Collections. It's a class instead of an interface because I guessed that it'd primarily be used for its inner classes.

Author:
Dan Klein (klein@cs.stanford.edu)
See Also:
Serialized Form

Nested Class Summary
static class CollectionFactory.ArrayListFactory<T>
           
static class CollectionFactory.HashSetFactory<T>
           
static class CollectionFactory.LinkedListFactory<T>
           
static class CollectionFactory.SizedArrayListFactory<T>
           
static class CollectionFactory.TreeSetFactory<T>
           
 
Field Summary
static CollectionFactory ARRAY_LIST_FACTORY
           
static CollectionFactory HASH_SET_FACTORY
           
static CollectionFactory LINKED_LIST_FACTORY
           
static CollectionFactory TREE_SET_FACTORY
           
 
Constructor Summary
CollectionFactory()
           
 
Method Summary
static
<E> CollectionFactory<E>
arrayListFactory()
          Return a factory for making ArrayList Collections.
static
<E> CollectionFactory<E>
arrayListFactory(int size)
           
static
<E> CollectionFactory<E>
hashSetFactory()
           
static
<E> CollectionFactory<E>
linkedListFactory()
           
abstract  java.util.Collection<T> newCollection()
           
abstract  java.util.Collection<T> newEmptyCollection()
           
static
<E> CollectionFactory<E>
treeSetFactory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARRAY_LIST_FACTORY

public static final CollectionFactory ARRAY_LIST_FACTORY

LINKED_LIST_FACTORY

public static final CollectionFactory LINKED_LIST_FACTORY

HASH_SET_FACTORY

public static final CollectionFactory HASH_SET_FACTORY

TREE_SET_FACTORY

public static final CollectionFactory TREE_SET_FACTORY
Constructor Detail

CollectionFactory

public CollectionFactory()
Method Detail

newCollection

public abstract java.util.Collection<T> newCollection()

newEmptyCollection

public abstract java.util.Collection<T> newEmptyCollection()

arrayListFactory

public static <E> CollectionFactory<E> arrayListFactory()
Return a factory for making ArrayList Collections. This method allows type safety in calling code.

Returns:
A factory for ArrayList collections.

arrayListFactory

public static <E> CollectionFactory<E> arrayListFactory(int size)

linkedListFactory

public static <E> CollectionFactory<E> linkedListFactory()

hashSetFactory

public static <E> CollectionFactory<E> hashSetFactory()

treeSetFactory

public static <E> CollectionFactory<E> treeSetFactory()


Stanford NLP Group