StringUtilities { public static String implodeMultiline(List<String> lines) { if (lines==null) return null; return implode(lines.toArray(new String[0]), "\n"); }  static String escape(String source); static String escape(String source, char delimiter); static String unescape(String source); static String implode(String[] array, String sepString); static String implodeMultiline(List<String> lines); static String truncateSequencesIfNecessary(String text, int maxConsecutiveLength); static String stripSuffix(String string, String suffix); static String quote(Object object); static Set<String> split(String s);  }
@Test public void testImplodeMultiline() { assertEquals(StringUtilities.implodeMultiline(Arrays.asList("foo", "bar")), "foo\nbar"); assertEquals(StringUtilities.implodeMultiline(Arrays.asList("")), ""); assertEquals(StringUtilities.implodeMultiline(null), null); assertEquals(StringUtilities.implodeMultiline(Arrays.asList("\n")), "\n"); }