List of utility methods to do Map to String
String | mapToString(Map map) spit out each name/value pair Set entries = map.entrySet(); Iterator iter = entries.iterator(); StringBuffer buff = new StringBuffer(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); buff.append("[" + entry.getKey() + "," + entry.getValue() + "]\n"); return buff.toString(); ... |
String | mapToString(Map extends Object, ? extends Object> map) map To String String mapString = map.toString();
return mapString.substring(1, mapString.length() - 1);
|
String | mapToString(Map extends Object, ? extends Object> map) map To String if (map == null) return "null"; StringBuilder sb = new StringBuilder(); for (Map.Entry<? extends Object, ? extends Object> entry : map.entrySet()) { Object key = entry.getKey(); Object val = entry.getValue(); sb.append(key).append("="); if (val == null) ... |
String | mapToString(Map extends Object, ? extends Object> map) Convert a map to a string representation (e.g: for toString()) StringBuilder sb = new StringBuilder(); if (map == null || map.isEmpty()) { return sb.toString(); for (Object key : map.keySet()) { sb.append(key.toString()); sb.append(" : "); sb.append(map.get(key).toString()); ... |
String | mapToString(Map, ?> map) map To String return mapToString("\n", ",", map); |
String | mapToString(Map, ?> map) map To String StringBuilder sb = new StringBuilder("{"); for (Map.Entry entry : map.entrySet()) { sb.append(entry.getKey()).append(": ").append(entry.getValue()).append(", "); return sb.append("}").toString(); |
String | mapToString(Map, ?> map) map To String if (map.isEmpty()) { return ""; StringBuilder stringBuilder = new StringBuilder(); boolean notFirst = false; for (Map.Entry<?, ?> entry : map.entrySet()) { if (notFirst) { stringBuilder.append(','); ... |
String | mapToString(Map, ?> map) map To String return mapToString(map, "=", ","); |
String | mapToString(Map map To String StringBuilder sb = new StringBuilder(); List<Character> keys = new ArrayList<Character>(acs.keySet()); Collections.sort(keys); for (Character c : keys) { sb.append(c); int count = acs.get(c); if (count > 1) { sb.append(count); ... |
String | mapToString(Map map To String if (m == null) return "null"; Set<Entry<K, V>> set = m.entrySet(); int max = set.size() - 1; if (max == -1) return "{}"; StringBuilder sb = new StringBuilder(); Iterator<Entry<K, V>> it = set.iterator(); ... |