Here you can find the source of print(List
public static <E> String print(List<E> items)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <E> String print(List<E> items) { StringBuilder builder = new StringBuilder(); for (E item : items) { builder.append(item).append(", "); }//from w ww . j a v a2 s. c o m return builder.length() > 2 ? builder.substring(0, builder.length() - 2) : builder.toString(); } }