Here you can find the source of combineLines(List
public static String combineLines(List<String> lines)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String combineLines(List<String> lines) { StringBuilder sb = new StringBuilder(); boolean firstLine = true; for (String line : lines) { if (firstLine) { sb.append("\n"); firstLine = false;/*from w w w. j a va 2s.c om*/ } sb.append(line); } return sb.toString(); } }