com.googlecode.ehcache.annotations.impl
Class MultiKeyConcurrentMap<K1,K2,V>

java.lang.Object
  extended by com.googlecode.ehcache.annotations.impl.MultiKeyConcurrentMap<K1,K2,V>
All Implemented Interfaces:
java.io.Serializable

public final class MultiKeyConcurrentMap<K1,K2,V>
extends java.lang.Object
implements java.io.Serializable

Simplified version of a ConcurrentMap that uses two keys. A nested map is used under the hood to make gets as fast as possible.

Version:
$Revision: 656 $
Author:
Eric Dalquist
See Also:
Serialized Form

Constructor Summary
MultiKeyConcurrentMap()
           
 
Method Summary
 boolean containsKey(K1 key1, K2 key2)
           
 V get(K1 key1, K2 key2)
           
 V put(K1 key1, K2 key2, V value)
           
 V putIfAbsent(K1 key1, K2 key2, V value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiKeyConcurrentMap

public MultiKeyConcurrentMap()
Method Detail

containsKey

public boolean containsKey(K1 key1,
                           K2 key2)
Parameters:
key1 - primary key
key2 - sub key
Returns:
true if the key-pair is contained
See Also:
Map.containsKey(Object)

put

public V put(K1 key1,
             K2 key2,
             V value)
Parameters:
key1 - primary key
key2 - sub key
value - The value to add to the map
Returns:
the previous value associated with the specified key or null if there was no previous value
See Also:
Map.put(Object, Object)

putIfAbsent

public V putIfAbsent(K1 key1,
                     K2 key2,
                     V value)
Parameters:
key1 - primary key
key2 - sub key
value - the value to add to the map if no previous value exists
Returns:
the previous value associated with the specified key or null if there was no previous value
See Also:
ConcurrentMap.putIfAbsent(Object, Object)

get

public V get(K1 key1,
             K2 key2)
Parameters:
key1 - primary key
key2 - sub key
Returns:
the value to which the specified keys are mapped, or null if there is no value
See Also:
Map.get(Object)


Copyright © 2011. All Rights Reserved.