Here you can find the source of prettyList(final List
private static String prettyList(final List<String> list)
//package com.java2s; /*=============================================================================# # Copyright (c) 2010-2015 Stephan Wahlbrink (WalWare.de) and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # /* w ww . j a v a2s.c o m*/ # Contributors: # Stephan Wahlbrink - initial API and implementation #=============================================================================*/ import java.util.List; public class Main { private static String prettyList(final List<String> list) { if (list.isEmpty()) { return ""; //$NON-NLS-1$ } final StringBuilder sb = new StringBuilder(list.size() * 10); for (final String s : list) { sb.append(s); sb.append(", "); //$NON-NLS-1$ } return sb.substring(0, sb.length() - 2); } }