Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;
import java.util.Iterator;

public class Main {
    public static String join(ArrayList<?> param, String sparator) {
        Iterator<?> it = param.iterator();
        StringBuilder sb = new StringBuilder();
        while (it.hasNext()) {
            Object i = it.next();
            sb.append(i);
            if (it.hasNext())
                sb.append(sparator);
        }
        return sb.toString();
    }

    public static String join(ArrayList<?> param) {
        return join(param, ",");
    }
}