Java List to String listToString(List list, String seperator)

Here you can find the source of listToString(List list, String seperator)

Description

list To String

License

Open Source License

Parameter

Parameter Description
list a parameter
seperator a parameter

Declaration

public static String listToString(List<?> list, String seperator) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**/*  www  .  j av  a  2  s  .c  om*/
     * 
     * @param list
     * @param seperator
     */
    public static String listToString(List<?> list, String seperator) {
        return listToString(list, "", seperator, "");
    }

    public static String listToString(List<?> list, String start, String seperator, String end) {
        StringBuilder builder = new StringBuilder(list.size() * 8);
        builder.append(start);
        for (int i = 0; i < list.size(); i++) {
            if (i > 0)
                builder.append(seperator);
            builder.append(list.get(i).toString());
        }
        builder.append(end);
        return builder.toString();
    }
}

Related

  1. listToString(List l, String delim)
  2. listToString(List l, String sep)
  3. listToString(List list)
  4. listToString(List list)
  5. listToString(List list, String separator, String prefix, String suffix)
  6. listToString(List list)
  7. listToString(List list)
  8. listToString(List list, String operator)
  9. listToString(List value)

    HOME | Copyright © www.java2s.com 2016