Flatten the map keys using period separator.
@param map the map that should be flattened
@return the flattened map
346536
private Map<String, Object> flatten(Map<String, Object> map) {
		Map<String, Object> result = new LinkedHashMap<>();
		flatten(null, result, map);
		return result;
	}
626784
public static Character getChar(Map<?, ?> map, Object key) {
		return get(map, key, Character.class);
	}
1236685
public Map<String, String> getStringMap(final Map<String, String> map) {
		final int len = getVInt();
		for (int i = 0; i < len; i++) {
			map.put(getString(), getString());
		}
		return map;
	}
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;
    }
430436
public static <K, V> Map<K, V> sortNumberMapByValueDescending(Map<K, V> map) {
        ArrayList<Map.Entry<K, V>> entries = new ArrayList<>(map.entrySet());
        Collections.sort(entries, (Map.Entry<K, V> a, Map.Entry<K, V> b) -> {
            Double va = TypeInference.toDouble(a.getValue());
            Double vb = TypeInference.toDouble(b.getValue());
            return -va.compareTo(vb);
        });
        
        Map<K, V> sortedMap = new LinkedHashMap<>();
        for (Map.Entry<K, V> entry : entries) {
          sortedMap.put(entry.getKey(), entry.getValue());
        }
        
        return sortedMap;
    }
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;
    }
134316
public static <X, Y> Map<Y, X> invert(Map<X, Y> map) {
    Map<Y, X> invertedMap = new HashMap<Y, X>();
    for (Map.Entry<X, Y> entry : map.entrySet()) {
      X key = entry.getKey();
      Y value = entry.getValue();
      invertedMap.put(value, key);
    }
    return invertedMap;
  }
454924
public void append(Map<?, ?> map) {
		if (map == null || map.size() == 0)
			return;

		for (Map.Entry<?, ?> entry : map.entrySet()) {
			put(StringConverter.toString(entry.getKey()), StringConverter.toNullableString(entry.getValue()));
		}
	}
139462
@Nullable
    public String toJson(@Nullable Map<String, Object> map) {
        if (map == null || map.isEmpty()) {
            return null;
        }

        try (StringWriter writer = new StringWriter(bufferSize)) {
            objectMapper.writeValue(writer, map);
            if (doesAppendLineSeparator) {
                writer.append(CoreConstants.LINE_SEPARATOR);
            }
            return writer.toString();
        } catch (IOException e) {
            throw new IllegalArgumentException("Unable to format map as a JSON", e);
        }
    }
1138193
public static <K, V> TreeMap<K, V> sort(Map<K, V> map) {
		return sort(map, null);
	}
201296
public Packer putStringMap(final Map<String, String> map) {
		putVInt(map.size());
		for (final Entry<String, String> e : map.entrySet()) {
			final String key = e.getKey();
			final String value = e.getValue();
			putString(key);
			putString(value);
		}
		return this;
	}
346921
public static final <S, K, V> Functional<S> functionalMap(Map<K, V> map) {
		return new FunctionalMap<S, K, V>(map);
	}
1184178
private static String convertMap2Pair(Map<String, String> map) {

        if (CommonUtils.isEmpty(map)) {
            return StringUtils.EMPTY;
        }

        StringBuilder sb = new StringBuilder(128);
        for (Map.Entry<String, String> entry : map.entrySet()) {
            sb.append(getKeyPairs(entry.getKey(), entry.getValue()));
        }

        return sb.toString();
    }
1004124
public static String mapToString(Map<String, ?> map) {
        StringBuilder sb = new StringBuilder();
        sb.append("{\n");
        for (String key : map.keySet()) {
            if (map.get(key) != null) {
                sb.append(key + ": " + map.get(key) + "\n ");
            } else {
                continue;
            }
        }
        sb.append("}");
        return sb.toString();
    }
1331402
public static <T> List<T> valuesToList(Map<?, T> map) {
        return new ArrayList<>(map.values());
    }
809644
public static String format(String s, Map<String, String> map) {
		StringBuilder sb = new StringBuilder((int)(s.length() * 1.5));
		int cursor = 0;
		for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf('}', start)) != -1;) {
			sb.append(s.substring(cursor, start));
			String key = s.substring(start + 2, end);
			sb.append(map.get(StringUtils.trim(key)));
			cursor = end + 1;
		}
		sb.append(s.substring(cursor, s.length()));
		return sb.toString();
	}
1313830
public static <K, V> Map<K, V> sortNumberMapByKeyDescending(Map<K, V> map) {
        return sortNumberMapByKeyDescending(map.entrySet());
    }