net.sf.mmm.util.collection.base
Class ConcurrentHashMapFactory

java.lang.Object
  extended by net.sf.mmm.util.collection.base.AbstractConcurrentMapFactory
      extended by net.sf.mmm.util.collection.base.ConcurrentHashMapFactory
All Implemented Interfaces:
ConcurrentMapFactory, MapFactory<ConcurrentMap>

public class ConcurrentHashMapFactory
extends AbstractConcurrentMapFactory

This is an implementation of the ConcurrentMapFactory interface that creates instances of ConcurrentHashMap.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
static ConcurrentMapFactory INSTANCE
          The singleton instance.
 
Constructor Summary
ConcurrentHashMapFactory()
           
 
Method Summary
<K,V> ConcurrentMap<K,V>
create()
          This method creates a new Map instance.
<K,V> ConcurrentMap<K,V>
create(int capacity)
          This method creates a new Map instance with the given capacity.
 Class<ConcurrentHashMap> getMapImplementation()
          This method gets the implementation of the map-interface used by this factory.
 
Methods inherited from class net.sf.mmm.util.collection.base.AbstractConcurrentMapFactory
createGeneric, createGeneric, getMapInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ConcurrentMapFactory INSTANCE
The singleton instance.

Constructor Detail

ConcurrentHashMapFactory

public ConcurrentHashMapFactory()
Method Detail

getMapImplementation

public Class<ConcurrentHashMap> getMapImplementation()
This method gets the implementation of the map-interface used by this factory.

Returns:
the Map implementation.

create

public <K,V> ConcurrentMap<K,V> create()
This method creates a new Map instance.
It is explicitly typed and respects the generic key and value type of the map. Therefore the type of the Map can NOT be bound to the generic type <MAP> because of limitations in Java's generic type system. You need to work on the actual sub-interface (e.g. SortedMapFactory) to get a more specific result type.

Type Parameters:
K - the type of keys maintained by the map.
V - the type of mapped values.
Returns:
the new map instance.

create

public <K,V> ConcurrentMap<K,V> create(int capacity)
This method creates a new Map instance with the given capacity. For a regular map this will be the initial capacity while a cache may never grow beyond this capacity limit and if reached force out entries last recently of frequently used.

Type Parameters:
K - the type of keys maintained by the map.
V - the type of mapped values.
Parameters:
capacity - is the capacity of the map to create.
Returns:
the new map instance.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.