Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Main { /** line separator. */ private static final String LINE_SEPARATOR = System.lineSeparator(); public static List<String> takeStrListFromList_List(final List<List<String>> pList) { final List<String> resList = new ArrayList<String>(pList.size()); for (int i = 0; i < pList.size(); i++) { resList.add(implode(pList.get(i))); } return resList; } public static String implode(final String[] pStrArray) { return implode(pStrArray, "\t"); } public static String implode(final Object[] pieces, final String glue) { final StringBuilder buf = new StringBuilder(110); for (int i = 0; i < pieces.length; i++) { if (0 < i) { buf.append(glue); } buf.append(pieces[i].toString()); } return buf.toString(); } public static String implode(final Iterable<?> pieces) { return implode(pieces, LINE_SEPARATOR); } public static String implode(final Iterable<?> pieces, final String glue) { if (pieces == null) { return ""; } final StringBuilder resBuf = new StringBuilder(100); final Iterator<?> iter = pieces.iterator(); resBuf.append(iter.next().toString()); while (iter.hasNext()) { resBuf.append(glue); resBuf.append(iter.next().toString()); } return resBuf.toString(); } }