Here you can find the source of putAllTransposed( Map
Parameter | Description |
---|---|
source_key_valueSet | a parameter |
output_value_key | a parameter |
public static void putAllTransposed( Map<Object, Set<Object>> source_key_valueSet, Map<Object, Object> output_value_key)
//package com.java2s; import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { /**/*w w w .j a v a 2 s . co m*/ * Takes a Map that goes from Object to Set, and fills in the transpose * * @param source_key_valueSet * @param output_value_key */ public static void putAllTransposed( Map<Object, Set<Object>> source_key_valueSet, Map<Object, Object> output_value_key) { for (Iterator<Object> it = source_key_valueSet.keySet().iterator(); it .hasNext();) { Object key = it.next(); Set<Object> values = source_key_valueSet.get(key); for (Iterator<Object> it2 = values.iterator(); it2.hasNext();) { Object value = it2.next(); output_value_key.put(value, key); } } } /** * Type-safe get * @param map * @param key * @return value */ public static <K, V, M extends Map<K, V>> V get(M map, K key) { return map.get(key); } }