Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

public class Main {
    public static <T> String listToString(List<T> list) {
        StringBuilder builder = new StringBuilder();
        boolean firstCheck = true;
        for (T s : list) {
            if (firstCheck) {
                builder.append(s);
                firstCheck = false;
            } else {
                builder.append(",");
                builder.append(s);
            }
        }
        return builder.toString();
    }
}