org.javimmutable.collections.common
Class MapAdaptor<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by org.javimmutable.collections.common.MapAdaptor<K,V>
All Implemented Interfaces:
Map<K,V>

@Immutable
public class MapAdaptor<K,V>
extends AbstractMap<K,V>

An immutable Map implementation backed by a JImmutableMap.


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
MapAdaptor(JImmutableMap<K,V> map)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object o)
           
 boolean containsValue(Object o)
          Uses O(n) traversal of the PersistentMap to search for a matching value.
 Set<Map.Entry<K,V>> entrySet()
           
 V get(Object o)
           
 boolean isEmpty()
           
 Set<K> keySet()
           
static
<K,V> MapAdaptor<K,V>
of(JImmutableMap<K,V> map)
           
 V put(K k, V v)
           
 void putAll(Map<? extends K,? extends V> map)
           
 V remove(Object o)
           
 int size()
           
 Collection<V> values()
           
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapAdaptor

public MapAdaptor(JImmutableMap<K,V> map)
Method Detail

of

public static <K,V> MapAdaptor<K,V> of(JImmutableMap<K,V> map)

size

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

isEmpty

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

containsKey

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

containsValue

public boolean containsValue(Object o)
Uses O(n) traversal of the PersistentMap to search for a matching value.

Specified by:
containsValue in interface Map<K,V>
Overrides:
containsValue in class AbstractMap<K,V>
Parameters:
o -
Returns:

get

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

put

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

remove

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

putAll

public void putAll(Map<? extends K,? extends V> map)
Specified by:
putAll in interface Map<K,V>
Overrides:
putAll in class AbstractMap<K,V>

clear

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

keySet

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

values

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

entrySet

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


Copyright © 2014 Burton Computer Corporation. All rights reserved.