org.jclouds.util
Class Multimaps2

java.lang.Object
  extended by org.jclouds.util.Multimaps2

public class Multimaps2
extends Object

Author:
Adrian Cole

Constructor Summary
Multimaps2()
           
 
Method Summary
static
<K,V> com.google.common.collect.ImmutableMultimap<K,V>
fromOldSchool(Map<K,Set<V>> in)
          Deprecated. 
static
<K,V> com.google.common.collect.Multimap<K,V>
replaceEntries(com.google.common.collect.Multimap<K,V> fromMultimap, com.google.common.collect.Multimap<K,V> updates)
           
static
<K,V> com.google.common.collect.Multimap<K,V>
replaceValue(com.google.common.collect.Multimap<K,V> fromMultimap, K key, V value)
           
static
<K,V> Map<K,Set<V>>
toOldSchool(com.google.common.collect.Multimap<K,V> in)
          Deprecated. 
static
<K1,K2,V> com.google.common.collect.Multimap<K2,V>
transformKeys(com.google.common.collect.Multimap<K1,V> in, com.google.common.base.Function<K1,K2> fn)
          change the keys but keep the values in-tact.
static
<K,V> com.google.common.collect.Multimap<K,V>
withoutKey(com.google.common.collect.Multimap<K,V> fromMultimap, K key)
           
static
<K,V> com.google.common.collect.Multimap<K,V>
withoutKeys(com.google.common.collect.Multimap<K,V> fromMultimap, Set<K> keys)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Multimaps2

public Multimaps2()
Method Detail

toOldSchool

@Deprecated
public static <K,V> Map<K,Set<V>> toOldSchool(com.google.common.collect.Multimap<K,V> in)
Deprecated. 

The traditional way to represent a graph in Java is Map>, which is awkward in a number of ways. Guava's Multimap framework makes it easy to handle a mapping from keys to multiple values.

Until we write or discover a gson Multimap deserializer, we may be stuck with this. TODO: ask on stackoverflow and/or jesse wilson


fromOldSchool

@Deprecated
public static <K,V> com.google.common.collect.ImmutableMultimap<K,V> fromOldSchool(Map<K,Set<V>> in)
Deprecated. 

See Also:
toOldSchool(com.google.common.collect.Multimap)

replaceValue

public static <K,V> com.google.common.collect.Multimap<K,V> replaceValue(com.google.common.collect.Multimap<K,V> fromMultimap,
                                                                         K key,
                                                                         V value)

replaceEntries

public static <K,V> com.google.common.collect.Multimap<K,V> replaceEntries(com.google.common.collect.Multimap<K,V> fromMultimap,
                                                                           com.google.common.collect.Multimap<K,V> updates)

withoutKey

public static <K,V> com.google.common.collect.Multimap<K,V> withoutKey(com.google.common.collect.Multimap<K,V> fromMultimap,
                                                                       K key)

withoutKeys

public static <K,V> com.google.common.collect.Multimap<K,V> withoutKeys(com.google.common.collect.Multimap<K,V> fromMultimap,
                                                                        Set<K> keys)

transformKeys

public static <K1,K2,V> com.google.common.collect.Multimap<K2,V> transformKeys(com.google.common.collect.Multimap<K1,V> in,
                                                                               com.google.common.base.Function<K1,K2> fn)
change the keys but keep the values in-tact.

Type Parameters:
K1 - input key type
K2 - output key type
V - value type
Parameters:
in - input map to transform
fn - how to transform the values
Returns:
immutableMap with the new keys.


Copyright © 2009-2013 jclouds. All Rights Reserved.