@Test public void testConcat() { assertEquals("", TextHelper.concat(new String[] {}, 0, ",")); assertEquals("", TextHelper.concat(new String[] {""}, 0, ",")); assertEquals("alpha", TextHelper.concat(new String[] { "alpha" }, 0, ",")); assertEquals("1, 2, 3", TextHelper.concat(new Integer[] { 1, 2, 3 }, 0, ", ")); assertEquals("2, 3", TextHelper.concat(new Integer[] { 1, 2, 3 }, 1, ", ")); assertEquals("3", TextHelper.concat(new Integer[] { 1, 2, 3 }, 2, ", ")); assertEquals("", TextHelper.concat(new Integer[] { 1, 2, 3 }, 3, ", ")); assertEquals("", TextHelper.concat(emptyList(), 0, ",")); assertEquals("", TextHelper.concat(singletonList(""), 0, ",")); assertEquals("alpha", TextHelper.concat(singletonList("alpha"), 0, ",")); assertEquals("1, 2, 3", TextHelper.concat(Arrays.asList(1, 2, 3), 0, ", ")); assertEquals("2, 3", TextHelper.concat(Arrays.asList(1, 2, 3), 1, ", ")); assertEquals("3", TextHelper.concat(Arrays.asList(1, 2, 3), 2, ", ")); assertEquals("", TextHelper.concat(Arrays.asList(1, 2, 3), 3, ", ")); }
public static <T> String concat(T a[], int offset, String sep, String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(start); if (a.length - offset > 0) { sb.append(a[offset]); for (int i = offset + 1, len = a.length; i < len; ++i) { sb.append(sep).append(a[i]); } } sb.append(end); return sb.toString(); }
TextHelper { public static <T> String concat(T a[], int offset, String sep, String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(start); if (a.length - offset > 0) { sb.append(a[offset]); for (int i = offset + 1, len = a.length; i < len; ++i) { sb.append(sep).append(a[i]); } } sb.append(end); return sb.toString(); } }
TextHelper { public static <T> String concat(T a[], int offset, String sep, String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(start); if (a.length - offset > 0) { sb.append(a[offset]); for (int i = offset + 1, len = a.length; i < len; ++i) { sb.append(sep).append(a[i]); } } sb.append(end); return sb.toString(); } private  TextHelper(); }
TextHelper { public static <T> String concat(T a[], int offset, String sep, String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(start); if (a.length - offset > 0) { sb.append(a[offset]); for (int i = offset + 1, len = a.length; i < len; ++i) { sb.append(sep).append(a[i]); } } sb.append(end); return sb.toString(); } private  TextHelper(); static String concat(T a[], int offset, String sep,
            String start, String end); static String concat(T a[], int offset, String sep); static String concat(Collection<T> a, int offset, String sep,
            String start, String end); static String concat(Collection<T> a, int offset, String sep); static String wrap(TextWidthCounter textWidthCounter, String s,
            int width, int initialOffset, String initialIndent,
            String subsequentIndent); static StringBuilder adjustSpace(StringBuilder sb, int width,
            int curWidth); static void printHelp(PrintWriter writer, String title, String help,
            TextWidthCounter textWidthCounter, int width); static String nonNull(String str); static List<String> findPrefix(Collection<String> src, String prefix); }
TextHelper { public static <T> String concat(T a[], int offset, String sep, String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(start); if (a.length - offset > 0) { sb.append(a[offset]); for (int i = offset + 1, len = a.length; i < len; ++i) { sb.append(sep).append(a[i]); } } sb.append(end); return sb.toString(); } private  TextHelper(); static String concat(T a[], int offset, String sep,
            String start, String end); static String concat(T a[], int offset, String sep); static String concat(Collection<T> a, int offset, String sep,
            String start, String end); static String concat(Collection<T> a, int offset, String sep); static String wrap(TextWidthCounter textWidthCounter, String s,
            int width, int initialOffset, String initialIndent,
            String subsequentIndent); static StringBuilder adjustSpace(StringBuilder sb, int width,
            int curWidth); static void printHelp(PrintWriter writer, String title, String help,
            TextWidthCounter textWidthCounter, int width); static String nonNull(String str); static List<String> findPrefix(Collection<String> src, String prefix); static final Locale LOCALE_ROOT; static final String LINESEP; }