Here you can find the source of toString(final List
public static String toString(final List<String> inMessages)
//package com.java2s; /*//w w w. j av a 2 s . c o m * Copyright ? 2011-2014 EPAM Systems/B2BITS? (http://www.b2bits.com). * * This file is part of STAFF. * * STAFF is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * STAFF is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with STAFF. If not, see <http://www.gnu.org/licenses/>. */ import java.util.List; public class Main { public static String toString(final List<String> inMessages) { if (inMessages.isEmpty()) { return "No errors detected"; } final StringBuilder builder = new StringBuilder(); Integer index = 0; for (String msg : inMessages) { if (index == 0) { builder.append('\n'); } builder.append(++index).append(") ").append(msg).append('\n'); } return builder.toString(); } }