Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static String toString(Collection coll) {
        return toString(coll, ", ");
    }

    public static String toString(Collection coll, String delim) {
        StringBuffer sb = new StringBuffer();
        for (Iterator it = coll.iterator(); it.hasNext();) {
            Object obj = it.next();
            sb.append(String.valueOf(obj));
            if (it.hasNext()) {
                sb.append(delim);
            }
        }
        return sb.toString();
    }
}