Java ArrayList Join join(ArrayList strings, String separator)

Here you can find the source of join(ArrayList strings, String separator)

Description

Join an array

License

Open Source License

Parameter

Parameter Description
strings The strings to join
separator A separator

Declaration

public static String join(ArrayList<String> strings, String separator) 

Method Source Code

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

import java.util.ArrayList;

public class Main {
    /**//from w  w w.j a  v a2 s .c  o m
     * Join an array
     * @param strings The strings to join
     * @param separator A separator
     * @return
     */
    public static String join(ArrayList<String> strings, String separator) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < strings.size(); i++) {
            if (i != 0)
                sb.append(separator);
            sb.append(strings.get(i));
        }
        return sb.toString();
    }
}

Related

  1. join(ArrayList list, String delimiter)
  2. Join(ArrayList list, String delimiter)
  3. join(ArrayList list, String joinChar)
  4. join(ArrayList nameList, String delimiter)
  5. join(ArrayList s, String delimiter)
  6. join(final ArrayList array, final String separator)
  7. join(final ArrayList arry, final String with)
  8. join(final ArrayList parts, final char separator)
  9. join(String glue, ArrayList a)