@Test public void testToString() { assertEquals("[name: 'paul']", StringUtil.toString("name", "paul")); assertEquals("[name: 'paul', address: 'a street']", StringUtil.toString("name", "paul", "address", "a street")); assertEquals("[name: <null>]", StringUtil.toString("name", null)); assertEquals("[name: 'paul', address: <null>]", StringUtil.toString("name", "paul", "address")); }
public static String toString(Object... keyValues) { StringBuilder result = new StringBuilder(); result.append('['); for (int i = 0; i < keyValues.length; i += 2) { if (i > 0) { result.append(", "); } result.append(keyValues[i]); result.append(": "); Object value = null; if ((i + 1) < keyValues.length) { value = keyValues[i + 1]; } if (value == null) { result.append("<null>"); } else { result.append('\''); result.append(value); result.append('\''); } } result.append(']'); return result.toString(); }
StringUtil { public static String toString(Object... keyValues) { StringBuilder result = new StringBuilder(); result.append('['); for (int i = 0; i < keyValues.length; i += 2) { if (i > 0) { result.append(", "); } result.append(keyValues[i]); result.append(": "); Object value = null; if ((i + 1) < keyValues.length) { value = keyValues[i + 1]; } if (value == null) { result.append("<null>"); } else { result.append('\''); result.append(value); result.append('\''); } } result.append(']'); return result.toString(); } }
StringUtil { public static String toString(Object... keyValues) { StringBuilder result = new StringBuilder(); result.append('['); for (int i = 0; i < keyValues.length; i += 2) { if (i > 0) { result.append(", "); } result.append(keyValues[i]); result.append(": "); Object value = null; if ((i + 1) < keyValues.length) { value = keyValues[i + 1]; } if (value == null) { result.append("<null>"); } else { result.append('\''); result.append(value); result.append('\''); } } result.append(']'); return result.toString(); }  }
StringUtil { public static String toString(Object... keyValues) { StringBuilder result = new StringBuilder(); result.append('['); for (int i = 0; i < keyValues.length; i += 2) { if (i > 0) { result.append(", "); } result.append(keyValues[i]); result.append(": "); Object value = null; if ((i + 1) < keyValues.length) { value = keyValues[i + 1]; } if (value == null) { result.append("<null>"); } else { result.append('\''); result.append(value); result.append('\''); } } result.append(']'); return result.toString(); }  static String collapsePathDots(String path); static boolean isNotBlank(String text); static boolean isBlank(String text); static boolean isEmpty(String text); static boolean endsWithIgnoreCase(String source, String suffix); static String defaultIfNull(String text); static String defaultIfNull(String text, String defaultValue); static boolean equals(String text1, String text2); static String toString(Object... keyValues); static int hashCode(String... values); static String substringBefore(String text, char separator); static String substringBeforeLast(String text, char separator); static String substringAfterLast(String text, char separator); static String substringAfter(String text, char c); }
StringUtil { public static String toString(Object... keyValues) { StringBuilder result = new StringBuilder(); result.append('['); for (int i = 0; i < keyValues.length; i += 2) { if (i > 0) { result.append(", "); } result.append(keyValues[i]); result.append(": "); Object value = null; if ((i + 1) < keyValues.length) { value = keyValues[i + 1]; } if (value == null) { result.append("<null>"); } else { result.append('\''); result.append(value); result.append('\''); } } result.append(']'); return result.toString(); }  static String collapsePathDots(String path); static boolean isNotBlank(String text); static boolean isBlank(String text); static boolean isEmpty(String text); static boolean endsWithIgnoreCase(String source, String suffix); static String defaultIfNull(String text); static String defaultIfNull(String text, String defaultValue); static boolean equals(String text1, String text2); static String toString(Object... keyValues); static int hashCode(String... values); static String substringBefore(String text, char separator); static String substringBeforeLast(String text, char separator); static String substringAfterLast(String text, char separator); static String substringAfter(String text, char c);  }