Java List to String toString(final List list, char delimiter)

Here you can find the source of toString(final List list, char delimiter)

Description

Convert a list of strings to a string separated by delimiter

License

Apache License

Parameter

Parameter Description
list List
delimiter Delimiter

Return

String

Declaration

public static String toString(final List<String> list, char delimiter) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    /**/*from w w w  .j av a  2  s .  c  o m*/
     * Convert a list of strings to a string separated by delimiter
     * @param list List
     * @param delimiter Delimiter
     * @return String
     */
    public static String toString(final List<String> list, char delimiter) {
        final StringBuilder b = new StringBuilder();
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                b.append(list.get(i));
                if (i != list.size() - 1) {
                    b.append(delimiter);
                }
            }
        }
        return b.toString();
    }
}

Related

  1. toString(final List list)
  2. toString(final List list, final String separtor)
  3. toString(final List list)
  4. toString(final List inMessages)
  5. toString(final List input)
  6. toString(final Object[] list)
  7. toString(List arguments)
  8. toString(List l)
  9. toString(List list)