Formats a collection of elements as a string.
@param items a non-null list of items
@param separator a string to separate items
@return a non-null string
162241
public static String format( Collection<String> items, String separator ) {

		StringBuilder sb = new StringBuilder();
		for( Iterator<String> it = items.iterator(); it.hasNext(); ) {
			sb.append( it.next());
			if( it.hasNext())
				sb.append( separator );
		}

		return sb.toString();
	}
832431
public static String join(Collection collection, String separator) {
        if (isEmpty(collection)) {
            return StringUtils.EMPTY;
        }
        StringBuilder sb = new StringBuilder();
        for (Object object : collection) {
            if (object != null) {
                String string = StringUtils.toString(object);
                if (string != null) {
                    sb.append(string).append(separator);
                }
            }
        }
        return sb.length() > 0 ? sb.substring(0, sb.length() - separator.length()) : StringUtils.EMPTY;
    }
1055117
public static MutableList<String> tokensToList(String string, String separator)
    {
        MutableList<String> list = Lists.mutable.empty();
        for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
        {
            String token = stringTokenizer.nextToken();
            list.add(token);
        }
        return list;
    }
699232
public static String join(final Object[] array, final String separator) {

    if (isEmpty(array)) {
      return "";
    }
    StringBuffer stringBuffer = new StringBuffer();
    boolean isFirstVisited = true;
    for (Object object : array) {
      if (isFirstVisited) {
        isFirstVisited = false;
      } else {
        stringBuffer.append(separator);
      }
      stringBuffer.append(ObjectUtils.toString(object));
    }
    return stringBuffer.toString();
  }
1128503
public static <E> String listAsString(List<E> list, String separator) {

        StringBuffer string = new StringBuffer(128);
        Iterator<E> it = list.iterator();
        while (it.hasNext()) {
            string.append(it.next());
            if (it.hasNext()) {
                string.append(separator);
            }
        }
        return string.toString();
    }
705767
public static String join(Collection<? extends Object> lst, String separator) {
        StringBuilder buf = new StringBuilder(lst.size() * 64);
        boolean first = true;
        for (Object value : lst) {
            if (first) first = false; else buf.append(separator);
            buf.append(value.toString());
        }
        return buf.toString();
    }
1175579
public static String join(String[] strings, String separator) {
      StringBuilder sb = new StringBuilder();
      boolean first = true;
      for (String s : strings) {
         if (first) {
            first = false;
         } else {
            sb.append(separator);
         }
         sb.append(s);
      }
      return sb.toString();
   }
1198278
public static String join(Collection strings, String sep) {
        return join(strings.iterator(), sep);
    }
665534
public static String[] split(String strings, String separator) {
		return split(strings, separator, DEFAULT_TRIM);
	}
224504
private String toSeparatedString(List<String> stringList, char separator) {

        StringBuffer result = new StringBuffer();
        Iterator<String> it = stringList.iterator();
        while (it.hasNext()) {
            result.append(it.next());
            if (it.hasNext()) {
                result.append(separator);
            }
        }
        return result.toString();
    }
277965
public static String joinByComma( List<String> items ) {
        StringBuilder sb = new StringBuilder();
        for( String item : items ) {
            sb.append(",").append(item);
        }
        if (sb.length() == 0) {
            return "";
        }
        return sb.substring(1);
    }
1367547
public static String join(Object[] objects, String separator) {
        String result;

        if (objects.length > 0) {
            result = objects[0].toString();
            for (int i = 1; i < objects.length; i++) {
                result += separator + objects[i].toString();
            }
        } else {
            result = "";
        }

        return result;
    }
343141
public static String join(final Object collection, final String separator) {

        Collection<?> convertedCollection = (Collection<?>) collection;
        return join(convertedCollection, separator);
    }
458322
public static String arrayJoin(List<String> arr, String separator) {
		return (arr == null || separator == null) ? "" : StringUtils.join(arr, separator);
	}
1088729
public String[] getStringArrayBySeparator(String key, String separator) {
    String value = getString(key);
    if (value != null) {
      String[] strings = StringUtils.splitByWholeSeparator(value, separator);
      String[] result = new String[strings.length];
      for (int index = 0; index < strings.length; index++) {
        result[index] = trim(strings[index]);
      }
      return result;
    }
    return ArrayUtils.EMPTY_STRING_ARRAY;
  }
660976
function join(separator, itemList) {
    var result = "";
    for (var i = 0; i < itemList.length; i++) {
        if (i > 0) {
            result += separator;
        }
        result += itemList[i];
    }
    return result;
}
1362836
public static String join(Iterable<?> iterable, String separator) {
        if (iterable != null) {
            StringBuilder buf = new StringBuilder();
            Iterator<?> it = iterable.iterator();
            char singleChar = separator.length() == 1 ? separator.charAt(0) : 0;
            while (it.hasNext()) {
                buf.append(it.next());
                if (it.hasNext()) {
                    if (singleChar != 0) {
                        // More efficient
                        buf.append(singleChar);
                    } else {
                        buf.append(separator);
                    }
                }
            }
            return buf.toString();
        } else {
            return "";
        }
    }