jwutil.collections
Class MapFactory

java.lang.Object
  extended by jwutil.collections.MapFactory
Direct Known Subclasses:
LightMap.Factory, MultiMapFactory, SetRepository.SimpleHashSetFactory

public abstract class MapFactory
extends java.lang.Object

MapFactory is a Map generator. Subclasses should implement constructions of specific types of Maps.

Note also that the current limitations on parametric types in Java mean that we can't easily type this class as MapFactory<M extends Map<K,V>,K,V>, as MapFactory<HashMap<K,V>,K,V> is not a subtype of MapFactory<Map<K,V>,K,V>, even though HashMap is a subtype of Map.

Version:
$Id: MapFactory.java 2249 2005-04-29 02:32:27Z joewhaley $
Author:
Felix S. Klock II

Field Summary
static MapFactory hashMapFactory
          A MapFactory that generates HashMaps.
static MapFactory treeMapFactory
          A MapFactory that generates TreeMaps.
 
Constructor Summary
MapFactory()
          Creates a MapFactory.
 
Method Summary
 java.util.Map makeMap()
          Generates a new, mutable, empty Map.
abstract  java.util.Map makeMap(java.util.Map map)
          Generates a new Map, using the entries of map as a template for its initial mappings.
static MapFactory synchronizedMapFactory(MapFactory mf)
          Returns a MapFactory that generates synchronized (thread-safe) Maps.
 
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.


treeMapFactory

public static final MapFactory treeMapFactory
A MapFactory that generates TreeMaps.

Constructor Detail

MapFactory

public MapFactory()
Creates a MapFactory.

Method Detail

makeMap

public java.util.Map makeMap()
Generates a new, mutable, empty Map.


makeMap

public abstract java.util.Map makeMap(java.util.Map map)
Generates a new Map, using the entries of map as a template for its initial mappings.


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(java.util.Map)


Copyright © 2004-2008 SUIF Compiler Group. All Rights Reserved.