Here you can find the source of join(ArrayList
private static String join(ArrayList<String> list)
//package com.java2s; /*/*from w ww .j a va 2 s. c om*/ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL. The Original Code is the DoPE Pharmacoepidemiology Toolbox. The Initial Developer of the Original Code is the Brigham and Women's Hospital Division of Pharmacoepidemiology. Contributor(s): Jeremy A. Rassen <jrassen@post.harvard.edu> */ import java.util.ArrayList; public class Main { private static String join(ArrayList<String> list) { if ((list == null) || (list.size() == 0)) return ""; StringBuilder sb = new StringBuilder(); boolean first = true; for (String item : list) { if (first) first = false; else sb.append(" "); sb.append(item.toUpperCase()); } return sb.toString(); } }