Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

public class Main {

    public static String collectionJoinElements(Collection collection, String split) {
        StringBuilder builder = new StringBuilder();

        int count = 0;
        for (Object object : collection) {
            builder.append(String.valueOf(object));
            count++;
            if (count < collection.size()) {
                builder.append(split);
            }
        }

        return builder.toString();
    }
}