|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jclouds.util.Maps2
public class Maps2
General utilities used in jclouds code for Maps
.
Constructor Summary | |
---|---|
Maps2()
|
Method Summary | ||
---|---|---|
static
|
composeMapSupplier(Iterable<com.google.common.base.Supplier<Map<K,V>>> suppliers)
|
|
static
|
convertUnsafe(com.google.common.collect.Multimap<K,V> in)
|
|
static
|
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
|
keySetFunction()
|
|
static
|
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
|
transformKeys(Map<K1,V> in,
com.google.common.base.Function<K1,K2> fn)
change the keys but keep the values in-tact. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Maps2()
Method Detail |
---|
public static <K> com.google.common.base.Function<Map<K,?>,Set<K>> keySetFunction()
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 key
k1
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 values
public 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-null
valueFunction
- the function that produces values for the keys
Maps.uniqueIndex(Iterable, Function)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |