List of utility methods to do Map Reverse
Map | reverse(Map reverse Map<Y, List<X>> result = new HashMap<Y, List<X>>(); for (X key : map.keySet()) { Y value = map.get(key); if (!result.containsKey(value)) { result.put(value, new ArrayList<X>()); result.get(value).add(key); for (Y key : result.keySet()) { Collections.sort(result.get(key)); return result; |
Map | reverse(final Map Reverses a map (switches key and value types). final Map<V, K> reversed = new HashMap<V, K>(map.size()); for (final Entry<K, V> e : map.entrySet()) { reversed.put(e.getValue(), e.getKey()); return reversed; |
void | reverse(Map source, Map target) reverse for (Iterator it = source.keySet().iterator(); it.hasNext();) {
Object key = it.next();
target.put(source.get(key), key);
|
void | reverse(Map source, Map target) reverse for (Map.Entry entry : (Iterable<Map.Entry>) source.entrySet()) {
target.put(entry.getValue(), entry.getKey());
|
LinkedHashMap | reverse(Map Reverses the order of a LinkedHashMap . if (in == null) return null; LinkedHashMap<K, V> m = new LinkedHashMap<K, V>(); List<K> keys = new ArrayList<K>(in.keySet()); List<V> values = new ArrayList<V>(in.values()); for (int i = in.size() - 1; i >= 0; i--) m.put(keys.get(i), values.get(i)); return m; ... |
Map | reverse(Map reverse Map<V, K> vkMap = new HashMap<V, K>(kvMap.size()); for (Map.Entry<K, V> e : kvMap.entrySet()) { vkMap.put(e.getValue(), e.getKey()); return vkMap; |
Map | reverse(Map Reversed a map, making the key value and the value key. Map<V, K> reversedMap = new HashMap<V, K>(); for (Map.Entry<K, V> entry : map.entrySet()) { reversedMap.put(entry.getValue(), entry.getKey()); return reversedMap; |
Map | reverse(Map Reverse. List<Map.Entry<K, V>> mapEntry = new LinkedList<Map.Entry<K, V>>(map.entrySet()); Collections.reverse(mapEntry); LinkedHashMap<K, V> reversedMap = new LinkedHashMap<K, V>(); for (Iterator<Map.Entry<K, V>> it = mapEntry.iterator(); it.hasNext();) { Map.Entry<K, V> entry = it.next(); reversedMap.put(entry.getKey(), entry.getValue()); return (reversedMap); ... |
void | reverse(Map Take key and value pairs from source and create map from value to key in target. Iterator<K> i = source.keySet().iterator();
while (i.hasNext()) {
K key = i.next();
V value = source.get(key);
target.put(value, key);
|
Map | reverse(Map reverse Map<String, Object> result = new LinkedHashMap<String, Object>(); List<String> keys = new ArrayList<String>(source.keySet()); Collections.reverse(keys); for (String key : keys) { result.put(key, source.get(key)); return result; |