Returns a map with the same keys as {@code map}, but the reverse iteration
order.

@param map
@return
344548
public static <A, B> Map<A, B> reverse(Map<A, B> map) {
    List<Map.Entry<A, B>> list = Lists.newArrayList(map.entrySet());
    Collections.reverse(list);
    return listToMap(list);
  }
1061472
public static Map<String, ?> redactValues(Map<String, ?> map) {
        Map<String, Object> result = new LinkedHashMap<String, Object>();
        result.putAll(map);
        for (String key : map.keySet()) {
            Object value = map.get(key);
            if (value == null) {
                result.put(key, value);
             } else if (value instanceof Map) {
                @SuppressWarnings("unchecked")
                Map<String, ?> bare = (Map<String, ?>) value;
                result.put(key, redactValues(bare));
            } else if (value instanceof String && StringUtils.isEmpty(value)){
                result.put(key, "");
            } else {
                result.put(key, "<redacted>");
            }
        }
        return result;
    }
1069302
public MapReduceOptions<T> map(final String map) {
        Assert.parametersNotNull("map", map);
        Assert.parameterNotEmpty("map", map);
        this.map = map;
        return this;
    }
352860
public static <K, V> Map<K, V> asDeepTierMap(Map<K, V> map) {
        return from(map).deepLook().tierKey().map();
    }
887510
public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) {
        if (map instanceof ImmutableMap<?, ?>) {
            return map;
        }
        return Collections.unmodifiableMap(map);
    }
812400
public static <K,V> List<Pair<K,V>> mapToPair(Map<K,V> map) {
        List<Pair<K,V>> ret = new ArrayList<>(map.size());
        for(Map.Entry<K,V> entry : map.entrySet()) {
            ret.add(Pair.of(entry.getKey(),entry.getValue()));
        }

        return ret;
    }
1182963
public String[] getKeysAsStrings(Map<String, ?> map) {
        String[] result = null;
        Set<String> keySet = map.keySet();
        int keySize = keySet.size();
        if (keySize > 0) {          
            result = keySet.toArray(new String[keySize]);
        }
        
        return result;
    }
298623
public static <S, T> Map<S, T> compactAndLockHashMap( HashMap<S, T> map )
  {
    if( map == null || map.isEmpty() )
    {
      return Collections.emptyMap();
    }

    if( map.size() == 1 )
    {
      Map.Entry<S, T> stEntry = map.entrySet().iterator().next();
      return Collections.singletonMap( stEntry.getKey(), stEntry.getValue() );
    }

    Map<S, T> newMap = new HashMap<S, T>( map.size(), 1 );
    newMap.putAll( map );
    return Collections.unmodifiableMap( newMap );
  }
1175953
public static <K, V> Map<K, V> asTierMap(Map<K, V> map) {
		return from(map).tierKey().map();
	}
625729
public static <X, Y> Map<Y, Set<X>> invertSet(Map<X, Y> map) {
    Map<Y, Set<X>> invertedMap = new HashMap<Y, Set<X>>();
    for (Map.Entry<X, Y> entry : map.entrySet()) {
      X key = entry.getKey();
      Y value = entry.getValue();
      putIntoValueHashSet(invertedMap, value, key);
    }
    return invertedMap;
  }
38254
static public <K,V> Map<K,V> map(Map<?,?> map)
	{
		return (Map<K,V>)map;
	}
1356409
private static <K, V> Map<K, V> synchronizedCopyMap(Map<K, V> map) {

        if (map == null) {
            return new HashMap<K, V>();
        }

        synchronized (map) {

            return new HashMap<K, V>(map);
        }
    }
1107358
public static <K, V> Map<V, K> inverse(Map<K, V> map) {
        return inverse(map, false);
    }
1131849
public static ValueMap map(Object... map) {
        if (map.length / 2 * 2 != map.length)
            throw new IllegalArgumentException("Arguments should be <String> key - <?> value pairs");

        Builder builder = new Builder();
        for (int i = 0; i < map.length; i += 2)
            builder.put((String)map[i], map[i + 1]);

        return builder.build();
    }
224794
public static <K, V> Map<K, V> asDeepMap(Map<K, V> map) {
		return from(map).deepLook().map();
	}
690961
public static <K, V> Map<K, V> sort(Map<K, V> map,
            Comparator<K> comparator) {
        TreeMap<K, V> sortedMap = new TreeMap<>(comparator);
        sortedMap.putAll(map);
        return sortedMap;
    }
765132
public static <K, V> Dictionary<K, V> wrap(Map<K, V> map) {
        if (map instanceof DictionaryAsMap) {
            return ((DictionaryAsMap<K, V>) map).getDictionary();
        }
        return new MapAsDictionary<K, V>(map);
    }