Java ArrayList Join join(String glue, ArrayList a)

Here you can find the source of join(String glue, ArrayList a)

Description

join

License

LGPL

Declaration

public static String join(String glue, ArrayList a) 

Method Source Code

//package com.java2s;
/*// w w w .  j a  va  2s  . c  o  m
 * OpenClinica is distributed under the
 * GNU Lesser General Public License (GNU LGPL).
    
 * For details see: http://www.openclinica.org/license
 * copyright 2003-2005 Akaza Research
 */

import java.util.ArrayList;

public class Main {
    public static String join(String glue, ArrayList a) {
        String answer = "";
        String join = "";

        for (int i = 0; i < a.size(); i++) {
            String s = (String) a.get(i);
            answer += join + s;
            join = glue;
        }

        return answer;
    }
}

Related

  1. join(ArrayList s, String delimiter)
  2. join(ArrayList strings, String separator)
  3. join(final ArrayList array, final String separator)
  4. join(final ArrayList arry, final String with)
  5. join(final ArrayList parts, final char separator)
  6. joinArrayList(List coll, String delimiter)
  7. joinArrayList(String joiner, ArrayList array)
  8. joinCommandLine(ArrayList lsCmdl)
  9. joinList(ArrayList list, String joint)