Java Collection Join join(Collection objects, String glue)

Here you can find the source of join(Collection objects, String glue)

Description

same thing as perl's join()

License

Open Source License

Declaration

public static String join(Collection objects, String glue) 

Method Source Code

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

import java.util.Collection;

public class Main {
    /**/*  w  ww. j  av  a 2  s .  c o m*/
     * same thing as perl's join()
     */
    public static String join(Collection objects, String glue) {
        StringBuilder builder = new StringBuilder();
        for (Object o : objects) {
            builder.append(o);
            builder.append(glue);
        }
        builder.setLength(builder.length() - 1);
        return builder.toString();
    }
}

Related

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