Here you can find the source of createErrorStringFromList(List
public static String createErrorStringFromList(List<String> errorList)
//package com.java2s; /*// w w w . j a v a2 s .c o m * Copyright (c) 2013 IANA. All Rights Reserved. THE AUTHOR MAKES NO * REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE * AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT * OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.util.List; public class Main { public static String createErrorStringFromList(List<String> errorList) { String errorString = ""; if (errorList != null && errorList.size() > 0) { if (errorList.size() == 1) { //no need to append <br/> at the end of each string errorString = errorList.get(0).toString(); } else { // Append <br/> at the end of each string for (int i = 0; i < errorList.size(); i++) { String str = errorList.get(i).toString() + "<br/>"; errorString += str; } } } return errorString; } }