| Constructor and Description |
|---|
Maps2() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> com.google.common.base.Supplier<Map<K,V>> |
composeMapSupplier(Iterable<com.google.common.base.Supplier<Map<K,V>>> suppliers) |
static <K,V> Map<K,V> |
convertUnsafe(com.google.common.collect.Multimap<K,V> in) |
static <K,V> Map<K,V> |
fromKeys(Set<K> keys,
com.google.common.base.Function<? super K,V> valueFunction)
Constructs a map with the given keys where values are generated by the given function.
|
static <K> com.google.common.base.Function<Map<K,?>,Set<K>> |
keySetFunction() |
static <V> Map<String,V> |
renameKey(Map<String,V> in,
String k1,
String k2)
If the supplied map contains the key
k1, its value will be assigned to the key k2. |
static <K1,K2,V> Map<K2,V> |
transformKeys(Map<K1,V> in,
com.google.common.base.Function<K1,K2> fn)
change the keys but keep the values in-tact.
|
public static <K,V> Map<K,V> convertUnsafe(com.google.common.collect.Multimap<K,V> in)
public static <V> Map<String,V> renameKey(Map<String,V> in, String k1, String k2)
k1, its value will be assigned to the key k2. Note that this doesn't modify the input map.V - type of value the map holdsin - the map you wish to make a copy ofk1 - old keyk2 - new keyk1
wasn't present.public static <K1,K2,V> Map<K2,V> transformKeys(Map<K1,V> in, com.google.common.base.Function<K1,K2> fn)
K1 - input key typeK2 - output key typeV - value typein - input map to transformfn - how to transform the valuespublic static <K,V> com.google.common.base.Supplier<Map<K,V>> composeMapSupplier(Iterable<com.google.common.base.Supplier<Map<K,V>>> suppliers)
public static <K,V> Map<K,V> fromKeys(Set<K> keys, com.google.common.base.Function<? super K,V> valueFunction)
null values, but null keys are not allowed.K - the type of the keysV - the type of the valueskeys - the keys to be included in the map. Keys must be non-nullvalueFunction - the function that produces values for the keysMaps.uniqueIndex(Iterable, Function)Copyright © 2009-2012 jclouds. All Rights Reserved.