List of utility methods to do Map to String
Map | toStringMap(Map, ?> map) Transform a map to a string map. Map<String, String> stringMap = new HashMap<>(); for (Map.Entry<?, ?> entry : map.entrySet()) { stringMap.put(entry.getKey().toString(), entry.getValue().toString()); return stringMap; |
Map | toStringMap(Map, ?> src) to String Map Map<String, String> dst = new HashMap<String, String>(); Set<?> entrySet = src.entrySet(); for (Object object : entrySet) { if (object != null && object instanceof Entry<?, ?>) { Entry<?, ?> entry = (Entry<?, ?>) object; Object key = entry.getKey(); Object value = entry.getValue(); if (key != null) { ... |
Map | toStringMap(Properties properties) to String Map Map<String, String> map = new HashMap<String, String>(); for (Object key : properties.keySet()) { map.put((String) key, properties.getProperty((String) key)); return map; |
Map | toStringMap(String... pairs) to String Map Map<String, String> parameters = new java.util.HashMap<String, String>(); if (pairs.length > 0) { if (pairs.length % 2 != 0) { throw new IllegalArgumentException("pairs must be even."); for (int i = 0; i < pairs.length; i = i + 2) { parameters.put(pairs[i], pairs[i + 1]); return parameters; |
Map | toStringMap(String... pairs) to String Map Map<String, String> parameters = new HashMap<String, String>(); if (pairs.length > 0) { if (pairs.length % 2 != 0) { throw new IllegalArgumentException("pairs must be even."); for (int i = 0; i < pairs.length; i = i + 2) { parameters.put(pairs[i], pairs[i + 1]); return parameters; |