org.cometd.util
Class ImmutableHashMap.Mutable

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by org.cometd.util.ImmutableHashMap.Mutable
All Implemented Interfaces:
Map<K,V>
Enclosing class:
ImmutableHashMap<K,V>

public class ImmutableHashMap.Mutable
extends AbstractMap<K,V>
implements Map<K,V>


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ImmutableHashMap.Mutable()
           
 
Method Summary
 ImmutableHashMap<K,V> asImmutable()
           
 void clear()
           
 boolean containsKey(Object key)
           
 Set<Map.Entry<K,V>> entrySet()
           
 V get(Object key)
           
 Map.Entry<K,V> getEntry(K key)
          Get an entry reference.
 ImmutableHashMap.MutableEntry<K,V> getEntryReference(K key)
          Get an entry reference.
 V put(K key, V value)
           
 V remove(Object key)
           
 int size()
           
 
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmpty, keySet, putAll, values
 

Constructor Detail

ImmutableHashMap.Mutable

public ImmutableHashMap.Mutable()
Method Detail

asImmutable

public ImmutableHashMap<K,V> asImmutable()

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in class AbstractMap<K,V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,V>
Overrides:
containsKey in class AbstractMap<K,V>

get

public V get(Object key)
Specified by:
get in interface Map<K,V>
Overrides:
get in class AbstractMap<K,V>

getEntry

public Map.Entry<K,V> getEntry(K key)
Get an entry reference.

Parameters:
key - The key to lookup.
Returns:
The found entry

getEntryReference

public ImmutableHashMap.MutableEntry<K,V> getEntryReference(K key)
                                                     throws IllegalStateException
Get an entry reference.

The entries stored in the top level of the maps entry buckets are never deleted, only nulled. Thus references returned to them can be kept over calls to reset and used to directly access the value without a hash lookup.

This method returns only such top level entries, or null if one cannot be created. Entries that do not exist are created with null values.

Parameters:
key - The key to lookup.
Returns:
The found entry
Throws:
IllegalStateException - if key is not a top level entry.

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>
Overrides:
put in class AbstractMap<K,V>

clear

public void clear()
Specified by:
clear in interface Map<K,V>
Overrides:
clear in class AbstractMap<K,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>
Overrides:
remove in class AbstractMap<K,V>

size

public int size()
Specified by:
size in interface Map<K,V>
Overrides:
size in class AbstractMap<K,V>


Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.