org.objectweb.jonathan.helpers

Class CollectionFactory


public class CollectionFactory
extends java.lang.Object

This class provides factory methods for the different kinds of Collections

Constructor Summary

CollectionFactory()
Simple default constructor

Method Summary

ArrayList
newArrayList(Object[] param)
Returns a new ArrayList using the given array of objects
HashMap
newHashMap(Object[] keys, Object[] values)
Returns a new HashMap
HashMap
newHashMap(Context aContext)
Returns a new HashMap based on the contents of a Context
HashSet
newHashSet(Object[] param)
Returns a new HashSet using the given array of objects
HashSet
newHashSet(Context aContext)
Returns a new HashSet based on the contents of a Context.
Hashtable
newHashtable(Object[] keys, Object[] values)
Returns a new Hashtable
Hashtable
newHashtable(Context aContext)
Returns a new Hashtable based on the contents of a Context
LinkedList
newLinkedList(Object[] param)
Returns a new LinkedList using the given array of objects
List
newList(Object[] param)
Returns a new List using the given array of objects.
Map
newMap(Object[] keys, Object[] values)
Returns a new Map.
Set
newSet(Object[] param)
Returns a new Set using the given array of objects.
Set
newSet(Context aContext)
Returns a new Set based on the contents of a Context.
TreeMap
newTreeMap(Object[] keys, Object[] values)
Returns a new TreeMap
TreeMap
newTreeMap(Object[] keys, Object[] values, Comparator aComparator)
Returns a new TreeMap
TreeSet
newTreeSet(Object[] param)
Returns a new TreeSet using the given array of objects
TreeSet
newTreeSet(Object[] param, Comparator aComparator)
Returns a new TreeSet using the given array of objects
Vector
newVector(Object[] param)
Returns a new Vector using the given array of objects

Constructor Details

CollectionFactory

public CollectionFactory()
Simple default constructor

Method Details

newArrayList

public ArrayList newArrayList(Object[] param)
Returns a new ArrayList using the given array of objects

Parameters:
param - the array to use to fill the list

Returns:
the ArrayList


newHashMap

public HashMap newHashMap(Object[] keys,
                          Object[] values)
Returns a new HashMap

Parameters:
keys - the vector making the keys
values - the vector making the values

Returns:
the HashMap


newHashMap

public HashMap newHashMap(Context aContext)
Returns a new HashMap based on the contents of a Context

Parameters:
aContext - the Context

Returns:
the HashMap


newHashSet

public HashSet newHashSet(Object[] param)
Returns a new HashSet using the given array of objects

Parameters:
param - the array to use to fill the list

Returns:
the HashSet


newHashSet

public HashSet newHashSet(Context aContext)
Returns a new HashSet based on the contents of a Context. The elements contained in the Context are added to the set

Parameters:
aContext - the Context

Returns:
the HashSet


newHashtable

public Hashtable newHashtable(Object[] keys,
                              Object[] values)
Returns a new Hashtable

Parameters:
keys - the vector making the keys
values - the vector making the values

Returns:
the Hashtable


newHashtable

public Hashtable newHashtable(Context aContext)
Returns a new Hashtable based on the contents of a Context

Parameters:
aContext - the Context

Returns:
the Hashtable


newLinkedList

public LinkedList newLinkedList(Object[] param)
Returns a new LinkedList using the given array of objects

Parameters:
param - the array to use to fill the list

Returns:
the LinkedList


newList

public List newList(Object[] param)
Returns a new List using the given array of objects. Uses an ArrayList.

Parameters:
param - the array to use to fill the list

Returns:
the List


newMap

public Map newMap(Object[] keys,
                  Object[] values)
Returns a new Map. Uses a HashMap.

Parameters:
keys - the vector making the keys
values - the vector making the values

Returns:
the Map


newSet

public Set newSet(Object[] param)
Returns a new Set using the given array of objects. Uses an HashSet.

Parameters:
param - the array to use to fill the list

Returns:
the Set


newSet

public Set newSet(Context aContext)
Returns a new Set based on the contents of a Context. The elements contained in the Context are added to the set Uses an HashSet.

Parameters:
aContext - the Context

Returns:
the Set


newTreeMap

public TreeMap newTreeMap(Object[] keys,
                          Object[] values)
Returns a new TreeMap

Parameters:
keys - the vector making the keys
values - the vector making the values

Returns:
the HashMap


newTreeMap

public TreeMap newTreeMap(Object[] keys,
                          Object[] values,
                          Comparator aComparator)
Returns a new TreeMap

Parameters:
keys - the vector making the keys
values - the vector making the values
aComparator - the comparator used to sort elements in the tree

Returns:
the HashMap


newTreeSet

public TreeSet newTreeSet(Object[] param)
Returns a new TreeSet using the given array of objects

Parameters:
param - the array to use to fill the list

Returns:
the TreeSet


newTreeSet

public TreeSet newTreeSet(Object[] param,
                          Comparator aComparator)
Returns a new TreeSet using the given array of objects

Parameters:
param - the array to use to fill the list
aComparator - the comparator used to sort elements in the tree

Returns:
the TreeSet


newVector

public Vector newVector(Object[] param)
Returns a new Vector using the given array of objects

Parameters:
param - the array to use to fill the list

Returns:
the Vector