fulmine.util.collection
Class CollectionFactory

java.lang.Object
  extended by fulmine.util.collection.CollectionFactory

public final class CollectionFactory
extends Object

A factory for constructing Collection instances. A ICollectionBuilder instance is used to construct the collection instances. The implementation of the builder is specified by setting the class name of the builder to use against the system property name ICollectionBuilder.

Author:
Ramon Servadei

Constructor Summary
CollectionFactory()
           
 
Method Summary
static
<T> List<T>
newList()
          Construct a List implementation with its implementation default size.
static
<T> List<T>
newList(Collection<T> other)
          Construct a List implementation from another Collection instance size.
static
<T> List<T>
newList(int size)
          Construct a List implementation with the given size.
static
<K,V> Map<K,V>
newMap()
          Construct a Map implementation with the implementation default size.
static
<K,V> Map<K,V>
newMap(int size)
          Construct a Map implementation with the given size.
static
<K,V> Map<K,V>
newMap(int size, float loadFactor)
          Construct a Map implementation with the given size and loadFactor.
static
<K,V> Map<K,V>
newMap(Map<K,V> other)
          Construct a Map implementation from another instance.
static
<T> Queue<T>
newQueue()
          Construct a Queue implementation with the implementation default size.
static
<T> Queue<T>
newQueue(int size)
          Construct a Queue implementation with the given size.
static
<T> Set<T>
newSet()
          Construct a Set implementation with the implementation default size.
static
<T> Set<T>
newSet(Collection<T> other)
          Construct a Set implementation from another Collection instance.
static
<T> Set<T>
newSet(int size)
          Construct a Set implementation with the given size.
static Map newUntypedMap(int size)
          Construct a Map implementation with the given size.
static Map newUntypedOrderedMap(int size)
          Construct a Map implementation with the given size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionFactory

public CollectionFactory()
Method Detail

newSet

public static <T> Set<T> newSet(int size)
Construct a Set implementation with the given size.

Type Parameters:
T - the type for the set elements
Parameters:
size - the size
Returns:
a Set implementation

newSet

public static <T> Set<T> newSet(Collection<T> other)
Construct a Set implementation from another Collection instance. This copies the contents of the other collection into the newly constructed implementation.

Type Parameters:
T - the type for the set elements
Parameters:
other - the other Collection instance to construct the Set from
Returns:
a Set implementation constructed from a Collection instance.

newSet

public static <T> Set<T> newSet()
Construct a Set implementation with the implementation default size.

Type Parameters:
T - the type for the set elements
Returns:
a Set implementation

newQueue

public static <T> Queue<T> newQueue()
Construct a Queue implementation with the implementation default size.

Type Parameters:
T - the type for the queue elements
Returns:
a Queue implementation

newQueue

public static <T> Queue<T> newQueue(int size)
Construct a Queue implementation with the given size.

Type Parameters:
T - the type for the queue elements
Parameters:
size - the size
Returns:
a Queue implementation

newList

public static <T> List<T> newList()
Construct a List implementation with its implementation default size.

Type Parameters:
T - the type for the list elements
Returns:
a List implementation

newList

public static <T> List<T> newList(Collection<T> other)
Construct a List implementation from another Collection instance size.

Type Parameters:
T - the type for the list elements
Parameters:
other - the other Collection to construct this list from
Returns:
a List implementation constructed with the elements of the other Collection

newList

public static <T> List<T> newList(int size)
Construct a List implementation with the given size.

Type Parameters:
T - the type for the list elements
Parameters:
size - the size
Returns:
a List implementation

newMap

public static <K,V> Map<K,V> newMap(int size)
Construct a Map implementation with the given size.

Type Parameters:
K - the type for the map keys
V - the type for the map values
Parameters:
size - the size
Returns:
a Map implementation

newUntypedOrderedMap

public static Map newUntypedOrderedMap(int size)
Construct a Map implementation with the given size. The implementation maintains insertion order and does not have any generic type information.

Parameters:
size - the size
Returns:
a Map implementation

newUntypedMap

public static Map newUntypedMap(int size)
Construct a Map implementation with the given size. This returns a map with no generic type information.

Parameters:
size - the size
Returns:
a Map implementation

newMap

public static <K,V> Map<K,V> newMap(int size,
                                    float loadFactor)
Construct a Map implementation with the given size and loadFactor.

Type Parameters:
K - the type for the map keys
V - the type for the map values
Parameters:
size - the size
loadFactor - the loadFactor
Returns:
a Map implementation

newMap

public static <K,V> Map<K,V> newMap(Map<K,V> other)
Construct a Map implementation from another instance. This copies the contents of the other map into the newly constructed implementation.

Type Parameters:
K - the type for the map keys
V - the type for the map values
Parameters:
other - the other instance to construct this map from
Returns:
a Map implementation constructed from the other instance.

newMap

public static <K,V> Map<K,V> newMap()
Construct a Map implementation with the implementation default size.

Type Parameters:
K - the type for the map keys
V - the type for the map values
Returns:
a Map implementation


Copyright © 2007-2009. All Rights Reserved.