harpoon.Util.Collections
Class Factories

java.lang.Object
  |
  +--harpoon.Util.Collections.Factories

public final class Factories
extends Object

Factories consists exclusively of static methods that operate on or return CollectionFactorys.

Version:
$Id: Factories.java,v 1.3 2002/02/26 22:47:35 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Field Summary
static ListFactory arrayListFactory
          Returns a ListFactory that generates ArrayLists.
static MapFactory hashMapFactory
          A MapFactory that generates HashMaps.
static SetFactory hashSetFactory
          A SetFactory that generates HashSets.
static SetFactory linearSetFactory
          A SetFactory that generates LinearSets backed by ArrayLists.
static ListFactory linkedListFactory
          A ListFactory that generates LinkedLists.
static SetFactory treeSetFactory
          A SetFactory that generates TreeSets.
 
Method Summary
static SetFactory mapSetFactory(MapFactory mf)
          Returns a SetFactory that generates MapSet views of maps generated by the given MapFactory.
static SetFactory multiMapSetFactory(MultiMap.Factory mf)
          Returns a SetFactory that generates MultiMapSet views of MultiMaps generated by the given MultiMapFactory.
static CollectionFactory noNullCollectionFactory(CollectionFactory cf)
           
static CollectionFactory synchronizedCollectionFactory(CollectionFactory cf)
          Returns a CollectionFactory that generates synchronized (thread-safe) Collections.
static ListFactory synchronizedListFactory(ListFactory lf)
          Returns a ListFactory that generates synchronized (thread-safe) Lists.
static MapFactory synchronizedMapFactory(MapFactory mf)
          Returns a MapFactory that generates synchronized (thread-safe) Maps.
static SetFactory synchronizedSetFactory(SetFactory sf)
          Returns a SetFactory that generates synchronized (thread-safe) Sets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashMapFactory

public static final MapFactory hashMapFactory
A MapFactory that generates HashMaps.


hashSetFactory

public static final SetFactory hashSetFactory
A SetFactory that generates HashSets.


linearSetFactory

public static final SetFactory linearSetFactory
A SetFactory that generates LinearSets backed by ArrayLists.


treeSetFactory

public static final SetFactory treeSetFactory
A SetFactory that generates TreeSets.


linkedListFactory

public static final ListFactory linkedListFactory
A ListFactory that generates LinkedLists.


arrayListFactory

public static ListFactory arrayListFactory
Returns a ListFactory that generates ArrayLists.

Method Detail

mapSetFactory

public static SetFactory mapSetFactory(MapFactory mf)
Returns a SetFactory that generates MapSet views of maps generated by the given MapFactory. These can be passed in as arguments to a GenericMultiMap, for example, to make a multimap of maps.


multiMapSetFactory

public static SetFactory multiMapSetFactory(MultiMap.Factory mf)
Returns a SetFactory that generates MultiMapSet views of MultiMaps generated by the given MultiMapFactory. These can be passed in as arguments to a GenericMultiMap, for example, to make a multimap of multimaps.


synchronizedCollectionFactory

public static CollectionFactory synchronizedCollectionFactory(CollectionFactory cf)
Returns a CollectionFactory that generates synchronized (thread-safe) Collections. The Collections generated are backed by the Collections generated by cf.

See Also:
Collections#synchronizedCollection

synchronizedSetFactory

public static SetFactory synchronizedSetFactory(SetFactory sf)
Returns a SetFactory that generates synchronized (thread-safe) Sets. The Sets generated are backed by the Sets generated by sf.

See Also:
Collections#synchronizedSet

synchronizedListFactory

public static ListFactory synchronizedListFactory(ListFactory lf)
Returns a ListFactory that generates synchronized (thread-safe) Lists. The Lists generated are backed by the Lists generated by lf.

See Also:
Collections#synchronizedList

synchronizedMapFactory

public static MapFactory synchronizedMapFactory(MapFactory mf)
Returns a MapFactory that generates synchronized (thread-safe) Maps. The Maps generated are backed by the Map generated by mf.

See Also:
Collections#synchronizedMap

noNullCollectionFactory

public static CollectionFactory noNullCollectionFactory(CollectionFactory cf)