Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static String collectionToSlashString(Collection<?> collection) {
        if (collection != null && collection.size() > 0) {
            StringBuilder sb = new StringBuilder();
            Object obj = null;
            for (Iterator<?> iterator = collection.iterator(); iterator.hasNext();) {
                obj = iterator.next();
                sb.append(obj.toString());
                if (iterator.hasNext()) {
                    sb.append("/");
                }
            }
            return sb.toString();
        } else {
            return "";
        }
    }
}