Join a collection or list of elements, using the separator provided.
For example, this could be used to join a list of strings by a comma,
i.e. ",".

@param collection - Collection&gt;?&lt;
@param separator - String
@return String - The joined string
190574
public static String join(Collection<?> collection, String separator)
  {
    return StringUtils.join(collection, separator);
  }
35595
public static String join(List<String> list) {
    if (list == null) {
      return null;
    }

    StringBuilder joined = new StringBuilder();
    boolean first = true;

    for (String element : list) {
      if (first) {
        first = false;
      } else {
        joined.append(",");
      }
      joined.append(element);
    }

    return joined.toString();
  }
1057795
public static function join($strings, $separator, $start = 0, $count = -1)
    {
        $string = '';

        $end = $count == -1 ? Collection::count($strings) : $count;

        for ($i = $start; $i < $end; $i++) {
            $string .= $strings[$i].$separator;

            if ($i == ($end - 1)) {
                $string .= $separator;
            }
        }

        return $string;
    }
638366
public static String join(Object array, char separator, Object... pieces) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, ii = Array.getLength(array); i < ii; ++i) {
            Object element = Array.get(array, i);
            sb.append(element != null ? element.toString() : "null").append(separator);
        }
        for (int i = 0; i < pieces.length; ++i) {
            sb.append(pieces[i] != null ? pieces[i].toString() : "null").append(separator);
        }
        if (sb.length() > 0) sb.setLength(sb.length()-1);
        return sb.toString();
    }
1062157
public static String join(List<String> list, String separator) {
        if (list == null) {
            return null;
        }

        return join(list.toArray(), separator, 0, list.size());
    }
329263
@Nonnull
    public static String joinToStr(List<String> joinList) {
        // with null check
        if (CollectionUtils.isEmpty(joinList)) {
            return "";
        }

        return Joiner.on("\n").join(joinList);
    }
466483
protected String join(Collection<?> list, String delimiter) {
        return Joiner.on(delimiter).join(list);
    }
148506
public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator, boolean isIgnoreNull) {
		final StringBuilder strBuilder = StrUtil.builder();
		boolean isFirst = true;
		for (Entry<K, V> entry : map.entrySet()) {
			if (false == isIgnoreNull || entry.getKey() != null && entry.getValue() != null) {
				if (isFirst) {
					isFirst = false;
				} else {
					strBuilder.append(separator);
				}
				strBuilder.append(Convert.toStr(entry.getKey())).append(keyValueSeparator).append(Convert.toStr(entry.getValue()));
			}
		}
		return strBuilder.toString();
	}
610227
public static String join(Collection<?> objectsToJoin, String separator) {
        if ((objectsToJoin != null) && !objectsToJoin.isEmpty()) {
            StringBuilder builder = new StringBuilder();
            for (Object object : objectsToJoin) {
                builder.append(object);
                builder.append(separator);
            }
            // Remove the last separator
            return builder.substring(0, builder.length() - separator.length());
        } else {
            return EMPTY;
        }
    }
535439
public static String joinWithInnerSeparator(String separator,
                                                Object... collection) {
        StringBuilder b = new StringBuilder();
        boolean first = true;

        for (Object o : collection) {
            if (first) {
                first = false;
            } else {
                b.append(separator);
            }
            b.append(o.toString());
            b.append(separator);
        }
        return b.toString();
    }
247795
@SuppressWarnings("rawtypes")
    public static String join(final Collection<?> col, final String separator,
            final boolean ignoreEmptyElement, final boolean trim, final ElementConverter elementConverter) {

        final List<Object> list = new ArrayList<Object>();
        for(Object element : col) {
            if(element == null) {
                continue;
            }

            Object value = element;

            if(element instanceof String) {
                String str = (String) element;
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim();
                }

            } else if(element instanceof Character && isEmpty(element.toString())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }

            } else if(char.class.isAssignableFrom(element.getClass())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }
            }

            list.add(value);

        }

        return join(list, separator, elementConverter);

    }
755104
public static String mkString(@javax.annotation.Nonnull final String separator, final String... strs) {
    return Arrays.asList(strs).stream().collect(Collectors.joining(separator));
  }
367829
public static String join(final Collection<String> seq, final String delimiter) {
    if (null == seq || seq.size() < 1) {
      return "";
    } else {
      StringBuilder aim = new StringBuilder();
      for (String one : seq) {
        if (null != delimiter && aim.length() > 0) {
          aim.append(delimiter);
        }
        aim.append(one);
      }
      return aim.toString();
    }
  }
1119849
public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator) {
		return join(map, separator, keyValueSeparator, false);
	}
800676
public static <T> String join(Collection<T> col, String delim) {
    StringBuilder sb = new StringBuilder();
    Iterator<T> iter = col.iterator();
    if (iter.hasNext())
      sb.append(iter.next().toString());
    while (iter.hasNext()) {
      sb.append(delim);
      sb.append(iter.next().toString());
    }
    return sb.toString();
  }
448196
public String join(String separator, final String keyValueSeparator) {
		return MapUtil.join(this.map, separator, keyValueSeparator);
	}
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;
}