Returns unmodifiable MapList.
@param <K>
@param <V>
@param map
@return
336019
public static final <K,V> MapList<K,V> unmodifiableMapList(MapList<K,V> map)
    {
        return new UnmodifiableMapList(Collections.unmodifiableMap(map), map.getComparator());
    }
845380
public static Mapper mapMapper(final Map map) {
        return new Mapper() {
            public Object map(final Object a) {
                return map.get(a);
            }
        };
    }
1039212
public static <K, KK, VV> Map<KK, VV> getAndPutMapIfAbsent(final Map<K, Map<KK, VV>> map, final K key) {
        Map<KK, VV> v = map.get(key);

        if (v == null) {
            v = new HashMap<>();
            v = map.put(key, v);
        }

        return v;
    }
1213499
@Deprecated
	public static <K, V> Map<V, K> inverse(Map<K, V> map) {
		Map<V, K> inverseMap;
		if (map instanceof LinkedHashMap) {
			inverseMap = new LinkedHashMap<>(map.size());
		} else if (map instanceof TreeMap) {
			inverseMap = new TreeMap<>();
		} else {
			inverseMap = new HashMap<>(map.size());
		}

		for (Entry<K, V> entry : map.entrySet()) {
			inverseMap.put(entry.getValue(), entry.getKey());
		}
		return inverseMap;
	}
1287570
public static <K, E> void addToList(Map<K, List<E>> map, K k, E e)
    {
        getList(map, k).add(e);
    }
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;
    }
799084
public static List<Map<String, Object>> nest(String key, Map<String, Object> map) {
        List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
        String patternString = MessageFormat.format("^{0}\\.([0-9]*)\\.(.*)", Pattern.quote(key));
        Pattern pattern = Pattern.compile(patternString);
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            String k = entry.getKey();
            Matcher matcher = pattern.matcher(k);
            if (matcher.matches()) {
                int base = 0;
                processMatch(result, entry.getValue(), matcher, base);
            }
        }
        return result;
    }
900468
public static <K, V> Map<K, V> toCamelCaseMap(Map<K, V> map) {
		return (map instanceof LinkedHashMap) ? new CamelCaseLinkedMap<>(map) : new CamelCaseMap<>(map);
	}
569000
public static <K, V> MapWrapper<K, V> wrap(Map<K, V> map) {
		return new MapWrapper<K, V>(map);
	}
672653
public Map<String, String> getHeadersToMap(Map<String, String> map) {
        if (map == null) map = new LinkedHashMap<>();
        final Map<String, String> map0 = map;
        header.forEach((k, v) -> map0.put(k, v));
        return map0;
    }
887510
public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) {
        if (map instanceof ImmutableMap<?, ?>) {
            return map;
        }
        return Collections.unmodifiableMap(map);
    }
56831
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
		return new MultiValueMapAdapter<K, V>(map);

	}
107018
public static <K,V> SortedMap<K,V> asImmutable(SortedMap<K, ? extends V> self) {
        return Collections.unmodifiableSortedMap(self);
    }
875124
public static <K, V> MutableList<Pair<K, V>> toListOfPairs(Map<K, V> map)
    {
        final MutableList<Pair<K, V>> pairs = FastList.newList(map.size());
        MapIterate.forEachKeyValue(map, new Procedure2<K, V>()
        {
            public void value(K key, V value)
            {
                pairs.add(Tuples.pair(key, value));
            }
        });
        return pairs;
    }
1135015
public static <K, E> Set<E> getAndPutLinkedHashSetIfAbsent(final Map<K, Set<E>> map, final K key) {
        Set<E> v = map.get(key);

        if (v == null) {
            v = new LinkedHashSet<>();
            v = map.put(key, v);
        }

        return v;
    }
1129014
public static <K,V> Map<K,V> asImmutable(Map<? extends K, ? extends V> self) {
        return Collections.unmodifiableMap(self);
    }
176018
public static <K, V> Map<K, V> immutableMapCopy(Map<K, V> map) {
      if (map == null) return null;
      if (map.isEmpty()) return Collections.emptyMap();
      if (map.size() == 1) {
         Map.Entry<K, V> me = map.entrySet().iterator().next();
         return Collections.singletonMap(me.getKey(), me.getValue());
      }

      Map<? extends K, ? extends V> copy = ObjectDuplicator.duplicateMap(map);

      if (copy == null)
         copy = attemptCopyConstructor(map, Map.class);
      if (copy == null)
         copy = new HashMap<>(map);

      return new ImmutableMapWrapper<>(copy);
   }