Here you can find the source of asStringList(List> coll)
Parameter | Description |
---|---|
coll | List to convert |
public static List<String> asStringList(List<?> coll)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**//from w ww .j a v a 2s. c o m * Returns a string list representation of the given list. * * @param coll * List to convert * @return A list containing string representations for all elements of the * input list. */ public static List<String> asStringList(List<?> coll) { List<String> result = new ArrayList<>(); for (Object t : coll) { result.add(t.toString()); } return result; } public static String toString(List<?> coll, char delimiter) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < coll.size(); i++) { builder.append(coll.get(i)); if (i < coll.size() - 1) builder.append(delimiter); } return builder.toString(); } }