org.jclouds.collect
Class TransformingMap<K,V1,V2>

java.lang.Object
  extended by java.util.AbstractMap<K,V2>
      extended by org.jclouds.collect.TransformingMap<K,V1,V2>
All Implemented Interfaces:
Map<K,V2>

public class TransformingMap<K,V1,V2>
extends AbstractMap<K,V2>

A map that transforms values on the way in and out. Inspired by the guava method Maps.transformValues.

Author:
Adrian Cole

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
TransformingMap(Map<K,V1> fromMap, com.google.common.base.Function<? super V1,V2> getFunction, com.google.common.base.Function<? super V2,V1> putFunction)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 Set<Map.Entry<K,V2>> entrySet()
           
 V2 get(Object key)
           
 V2 put(K key, V2 value)
           
 V2 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
 

Constructor Detail

TransformingMap

public TransformingMap(Map<K,V1> fromMap,
                       com.google.common.base.Function<? super V1,V2> getFunction,
                       com.google.common.base.Function<? super V2,V1> putFunction)
Method Detail

size

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

put

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

containsKey

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

get

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

remove

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

clear

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

entrySet

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


Copyright © 2009-2011 jclouds. All Rights Reserved.