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.List;

public class Main {
    public static String integerListToString(List<Integer> list, String segmentation) {
        if (isEmpty(list)) {
            return null;
        }

        StringBuilder sb = new StringBuilder();
        for (int i : list) {
            sb.append(segmentation);
            sb.append(i);
        }

        return sb.substring(segmentation.length());
    }

    private static boolean isEmpty(Collection<?> coll) {
        return (coll == null || coll.isEmpty());
    }
}