Java List Print prettyList(final List list)

Here you can find the source of prettyList(final List list)

Description

pretty List

License

Open Source License

Declaration

private static String prettyList(final List<String> list) 

Method Source Code

//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);
    }
}

Related

  1. getGenBlueprintName(String slavenodelist, List masterList)
  2. limitLengthOfPrintedList(Collection list)
  3. prettyList(List list)
  4. prettyPrint(List userPermissions)
  5. prettyPrint(List rows)
  6. prettyPrintArgv(List argv)