fulmine.util.collection
Class CollectionBuilder

java.lang.Object
  extended by fulmine.util.collection.CollectionBuilder
All Implemented Interfaces:
ICollectionBuilder

public class CollectionBuilder
extends Object
implements ICollectionBuilder

Implementation that returns standard JDK Collection instances.

Author:
Ramon Servadei

Constructor Summary
CollectionBuilder()
           
 
Method Summary
<T> List<T>
newList()
          Construct a List implementation with its implementation default size.
<T> List<T>
newList(Collection<T> other)
          Construct a List implementation from another Collection instance size.
<T> List<T>
newList(int size)
          Construct a List implementation with the given size.
<K,V> Map<K,V>
newMap()
          Construct a Map implementation with the implementation default size.
<K,V> Map<K,V>
newMap(int size)
          Construct a Map implementation with the given size.
<K,V> Map<K,V>
newMap(int size, float loadFactor)
          Construct a Map implementation with the given size and loadFactor.
<K,V> Map<K,V>
newMap(Map<K,V> other)
          Construct a Map implementation from another instance.
<T> Queue<T>
newQueue()
          Construct a Queue implementation with the implementation default size.
<T> Queue<T>
newQueue(int size)
          Construct a Queue implementation with the given size.
<T> Set<T>
newSet()
          Construct a Set implementation with the implementation default size.
<T> Set<T>
newSet(Collection<T> other)
          Construct a Set implementation from another Collection instance.
<T> Set<T>
newSet(int size)
          Construct a Set implementation with the given size.
 Map newUntypedMap(int size)
          Construct a Map implementation with the given size.
 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

CollectionBuilder

public CollectionBuilder()
Method Detail

newSet

public <T> Set<T> newSet(int size)
Description copied from interface: ICollectionBuilder
Construct a Set implementation with the given size.

Specified by:
newSet in interface ICollectionBuilder
Type Parameters:
T - the type for the set elements
Parameters:
size - the size
Returns:
a Set implementation

newSet

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

Specified by:
newSet in interface ICollectionBuilder
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 <T> Set<T> newSet()
Description copied from interface: ICollectionBuilder
Construct a Set implementation with the implementation default size.

Specified by:
newSet in interface ICollectionBuilder
Type Parameters:
T - the type for the set elements
Returns:
a Set implementation

newQueue

public <T> Queue<T> newQueue()
Description copied from interface: ICollectionBuilder
Construct a Queue implementation with the implementation default size.

Specified by:
newQueue in interface ICollectionBuilder
Type Parameters:
T - the type for the queue elements
Returns:
a Queue implementation

newQueue

public <T> Queue<T> newQueue(int size)
Description copied from interface: ICollectionBuilder
Construct a Queue implementation with the given size.

Specified by:
newQueue in interface ICollectionBuilder
Type Parameters:
T - the type for the queue elements
Parameters:
size - the size
Returns:
a Queue implementation

newList

public <T> List<T> newList()
Description copied from interface: ICollectionBuilder
Construct a List implementation with its implementation default size.

Specified by:
newList in interface ICollectionBuilder
Type Parameters:
T - the type for the list elements
Returns:
a List implementation

newList

public <T> List<T> newList(Collection<T> other)
Description copied from interface: ICollectionBuilder
Construct a List implementation from another Collection instance size.

Specified by:
newList in interface ICollectionBuilder
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 <T> List<T> newList(int size)
Description copied from interface: ICollectionBuilder
Construct a List implementation with the given size.

Specified by:
newList in interface ICollectionBuilder
Type Parameters:
T - the type for the list elements
Parameters:
size - the size
Returns:
a List implementation

newMap

public <K,V> Map<K,V> newMap(int size)
Description copied from interface: ICollectionBuilder
Construct a Map implementation with the given size.

Specified by:
newMap in interface ICollectionBuilder
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 Map newUntypedOrderedMap(int size)
Description copied from interface: ICollectionBuilder
Construct a Map implementation with the given size. The implementation maintains insertion order and does not have any generic type information.

Specified by:
newUntypedOrderedMap in interface ICollectionBuilder
Parameters:
size - the size
Returns:
a Map implementation

newUntypedMap

public Map newUntypedMap(int size)
Description copied from interface: ICollectionBuilder
Construct a Map implementation with the given size. This returns a map with no generic type information.

Specified by:
newUntypedMap in interface ICollectionBuilder
Parameters:
size - the size
Returns:
a Map implementation

newMap

public <K,V> Map<K,V> newMap(int size,
                             float loadFactor)
Description copied from interface: ICollectionBuilder
Construct a Map implementation with the given size and loadFactor.

Specified by:
newMap in interface ICollectionBuilder
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 <K,V> Map<K,V> newMap(Map<K,V> other)
Description copied from interface: ICollectionBuilder
Construct a Map implementation from another instance. This copies the contents of the other map into the newly constructed implementation.

Specified by:
newMap in interface ICollectionBuilder
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 <K,V> Map<K,V> newMap()
Construct a Map implementation with the implementation default size.

Specified by:
newMap in interface ICollectionBuilder
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.