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 {
    /**
     * Helper method to format a list of names.
     * @param names The list of names
     */
    public static String formatNames(List<String> names) {
        if (names == null || names.size() == 0)
            return "";

        String namesListString = names.get(0);

        for (int i = 1; i < names.size(); i++) {
            namesListString += ", " + names.get(i);
        }
        return namesListString;
    }
}