Java Collection Join join(Collection coll, String separator)

Here you can find the source of join(Collection coll, String separator)

Description

join

License

Open Source License

Declaration

public static <T> String join(Collection<T> coll, String separator) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static <T> String join(Collection<T> coll, String separator) {
        if (coll == null)
            return null;
        StringBuilder sb = new StringBuilder();
        boolean looped = false;
        for (T t : coll) {
            if (looped)
                sb.append(separator);/*from   ww  w .  jav  a 2s .c  o  m*/
            sb.append(t.toString());
            looped = true;
        }
        return sb.toString();
    }
}

Related

  1. join(Collection strs, String sep)
  2. join(Collection thisPath, String _delim)
  3. join(Collection values)
  4. join(Collection words, String character)
  5. join(Collection c, String concatinator)
  6. join(Collection collec, String delimiter)
  7. join(Collection collection, CharSequence joinedBy)
  8. join(Collection collection, String joinString)
  9. join(Collection collections, String separator)