List of utility methods to do Map to String
String | mapToString(Map map To String LinkedList<String> pairs = new LinkedList<String>(); ArrayList<String> keyList = new ArrayList<String>(map.keySet()); Collections.sort(keyList); for (String s : keyList) { Object value = map.get(s); String valueStr = toString(value); pairs.add(s + ": " + valueStr); return "{" + join(", ", pairs.toArray()) + "}"; |
String | mapToString(Map Create a string representation of Map. StringBuilder criteriaMapStr = new StringBuilder(); if ((null == criteria) || (criteria.isEmpty())) { criteriaMapStr.append("[]"); } else { Iterator<Entry<String, String>> iterator = criteria.entrySet().iterator(); Entry<String, String> entry; criteriaMapStr.append("["); while (iterator.hasNext()) { ... |
String | MapToString(Map Map To String String result = ""; Iterator<String> keySetIterator = map.keySet().iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); result += "|" + key + ":" + map.get(key); return result; |
String | mapToString(Map map To String StringBuilder stringBuilder = new StringBuilder(); if (null != map && !map.isEmpty()) { List<String> lst = new ArrayList<>(map.keySet()); for (String key : lst) { stringBuilder.append(key + "=" + map.get(key)); if (!key.equals(lst.get(lst.size() - 1))) { stringBuilder.append("&"); return stringBuilder.toString(); |
String | mapToString(Map Convert a map to a string of key/val pairs of the form key1=val1, separated by semicolons. String ret = ""; for (String key : map.keySet()) { ret += key + "=" + map.get(key) + "; "; return ret; |
String | mapToString(Map map To String StringBuilder sb = new StringBuilder(); sb.append("["); if (map != null && map.size() > 0) { int i = 0; for (Map.Entry<String, String> entry : map.entrySet()) { if (i + 1 == map.size()) { sb.append(entry.getKey()).append("=").append(entry.getValue()); } else { ... |
String | mapToString(Map map To String StringBuffer buf = new StringBuffer(); for (String key : map.keySet()) { buf.append(key).append('='); if (map.containsKey(key)) { buf.append(map.get(key)); buf.append("\n"); return buf.toString(); |
String | mapToString(Map Converts a Map to Query String. StringBuilder stringBuilder = new StringBuilder(); for (String key : map.keySet()) { if (stringBuilder.length() > 0) { stringBuilder.append("&"); String value = map.get(key); stringBuilder.append(((key != null) ? key : "")); if (value != null) { ... |
String | mapToString(Map map To String StringBuilder sb = new StringBuilder().append('['); for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) { sb.append(entry.getKey()).append(" -> "); String[] value = entry.getValue(); if (value != null) { sb.append("("); appendTo(sb, Arrays.asList(value), ","); sb.append(")"); ... |
String | mapToString(Map map To String if (map.size() == 0) return ""; Iterator iterator = map.keySet().iterator(); String key = (String) iterator.next(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(key); stringBuilder.append(":"); stringBuilder.append(map.get(key)); ... |