MCPcopy Create free account
hub / github.com/apache/pig / mapToString

Method mapToString

src/org/apache/pig/data/DataType.java:1605–1624  ·  view source on GitHub ↗

Given a map, turn it into a String. @param m map @return string representation of the map

(Map<String, Object> m)

Source from the content-addressed store, hash-verified

1603 * @return string representation of the map
1604 */
1605 public static String mapToString(Map<String, Object> m) {
1606 boolean hasNext = false;
1607 StringBuilder sb = new StringBuilder();
1608 sb.append("[");
1609 for(Map.Entry<String, Object> e: m.entrySet()) {
1610 if(hasNext) {
1611 sb.append(",");
1612 } else {
1613 hasNext = true;
1614 }
1615 sb.append(e.getKey());
1616 sb.append("#");
1617 Object val = e.getValue();
1618 if(val != null) {
1619 sb.append(val.toString());
1620 }
1621 }
1622 sb.append("]");
1623 return sb.toString();
1624 }
1625
1626 /**
1627 * Test whether two byte arrays (Java byte arrays not Pig byte arrays) are

Callers 6

toDelimitedStringMethod · 0.95
testBytesToMapMethod · 0.95
testMapToBytesMethod · 0.95
toBytesMethod · 0.95
formatMethod · 0.95
toBytesMethod · 0.95

Calls 5

entrySetMethod · 0.80
appendMethod · 0.65
getValueMethod · 0.65
getKeyMethod · 0.45
toStringMethod · 0.45

Tested by 3

toDelimitedStringMethod · 0.76
testBytesToMapMethod · 0.76
testMapToBytesMethod · 0.76