Here you can find the source of toString(List
Parameter | Description |
---|---|
list | The List you want to convert |
public static String toString(List<String> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from w w w . j ava 2s . c o m*/ * Forms the StringList into a normal sentence with Spaces * * @param list The List you want to convert * @return Converted String */ public static String toString(List<String> list) { return toString(list.toArray(new String[list.size()])); } /** * Forms the String Array into a normal sentence with Spaces * * @param list The List you want to convert * @return Converted String */ public static String toString(String... list) { return toString(0, list); } /** * Forms the String Array into a normal sentence with Spaces * and excludes the first X entries * * @param list The List you want to convert * @param excluded The Start Index for the String Array * @return Converted String */ public static String toString(int excluded, String... list) { StringBuilder builder = new StringBuilder(); for (int i = excluded; i < list.length; i++) { if (i > excluded) builder.append(" "); builder.append(list[i]); } return builder.toString(); } }