com.taco.data
Interface ICollectionFactory


public interface ICollectionFactory

A factory that creates instances of Collection.


Field Summary
static ICollectionFactory ARRAY_LIST_FACTORY
          A factory that creates instances of ArrayList.
static ICollectionFactory HASH_SET_FACTORY
          A factory that creates instances of HashSet.
static ICollectionFactory LINKED_HASH_SET_FACTORY
          A factory that creates instances of LinkedHashSet.
static ICollectionFactory LINKED_LIST_FACTORY
          A factory that creates instances of LinkedList.
static ICollectionFactory TREE_SET_FACTORY
          A factory that creates instances of TreeSet.
static ICollectionFactory VECTOR_FACTORY
          A factory that creates instances of Vector.
 
Method Summary
 java.util.Collection createCollection()
          Create a new instance of a collection, which is initially empty.
 java.util.Collection createCollection(java.util.Collection source)
          Create a collection that contains the same elements as source.
 java.util.Collection createCollection(int capacity)
          Create a new instance of a collection, which is initially empty.
 

Field Detail

ARRAY_LIST_FACTORY

static final ICollectionFactory ARRAY_LIST_FACTORY
A factory that creates instances of ArrayList.


LINKED_LIST_FACTORY

static final ICollectionFactory LINKED_LIST_FACTORY
A factory that creates instances of LinkedList.


HASH_SET_FACTORY

static final ICollectionFactory HASH_SET_FACTORY
A factory that creates instances of HashSet.


LINKED_HASH_SET_FACTORY

static final ICollectionFactory LINKED_HASH_SET_FACTORY
A factory that creates instances of LinkedHashSet.


TREE_SET_FACTORY

static final ICollectionFactory TREE_SET_FACTORY
A factory that creates instances of TreeSet.


VECTOR_FACTORY

static final ICollectionFactory VECTOR_FACTORY
A factory that creates instances of Vector.

Method Detail

createCollection

java.util.Collection createCollection()
Create a new instance of a collection, which is initially empty.

Returns:
A new, empty collection.

createCollection

java.util.Collection createCollection(int capacity)
Create a new instance of a collection, which is initially empty. If possible, try to ensure that the collection can hold capacity elements without resizing.

Returns:
A new, empty collection.

createCollection

java.util.Collection createCollection(java.util.Collection source)
Create a collection that contains the same elements as source.

Parameters:
source - The collection to copy.
Returns:
A collection with the same elements as the argument.
Throws:
java.lang.NullPointerException - if source is null.