Java Collection Join join(Collection parts, String sep)

Here you can find the source of join(Collection parts, String sep)

Description

join

License

Open Source License

Declaration

static public String join(Collection parts, String sep) 

Method Source Code

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

import java.util.Collection;

public class Main {
    static public String join(Collection parts, String sep) {
        StringBuffer sb = new StringBuffer();
        int counter = 0;
        for (Object o : parts) {
            if (counter != 0) {
                sb.append(sep);/*ww  w.j a  va  2  s  . c  om*/
            }
            sb.append(o);
            counter++;
        }
        return sb.toString();
    }
}

Related

  1. join(Collection items)
  2. join(Collection list, char separator)
  3. join(Collection lst, String delim)
  4. join(Collection objects, String glue)
  5. join(Collection paramCollection, String paramString)
  6. join(Collection s, String delimiter)
  7. join(Collection s, String delimiter, boolean doQuote)
  8. join(Collection strings, String sep)
  9. join(Collection strings, String separator)