Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

public class Main {
    /**
     * Joins the arraylist into a single string, combining them with commas.
     * @param list
     * @return
     */
    public static String join(ArrayList<String> list) {
        String item = "";

        for (int i = 0; i < list.size(); i++) {
            if (i > 0)
                item += ",";

            item += list.get(i);
        }

        return item;
    }
}