Here you can find the source of strjoin(String sep, String... args)
public static String strjoin(String sep, String... args)
//package com.java2s; import java.util.List; public class Main { /** Concatentate string, using a separator */ public static String strjoin(String sep, String... args) { return join(sep, args); }// www . ja va2s . co m /** Concatentate string, using a separator */ public static String strjoin(String sep, List<String> args) { return join(sep, args); } /** Join an array of strings */ private static String join(String sep, String... a) { if (a.length == 0) return ""; if (a.length == 1) return a[0]; StringBuilder sbuff = new StringBuilder(); sbuff.append(a[0]); for (int i = 1; i < a.length; i++) { if (sep != null) sbuff.append(sep); sbuff.append(a[i]); } return sbuff.toString(); } /** Join a list of strings */ private static String join(String sep, List<String> a) { return join(sep, a.toArray(new String[0])); } }