Java List to String listToString(List a, String separator)

Here you can find the source of listToString(List a, String separator)

Description

list To String

License

Open Source License

Declaration

public static String listToString(List a, String separator) 

Method Source Code


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

import java.util.List;

public class Main {
    public static String listToString(List a, String separator) {
        StringBuffer result = new StringBuffer();
        if (a.size() > 0) {
            result.append(a.get(0).toString());
            for (int i = 1; i < a.size(); i++) {
                result.append(separator);
                result.append(a.get(i).toString());
            }//from  w w  w . j a v  a2  s . c  o  m
        }
        return result.toString();
    }
}

Related

  1. listToString(Collection l)
  2. listToString(final List list, final String separator)
  3. listToString(final List list)
  4. listToString(final List stringList)
  5. listToString(Iterable list)
  6. listToString(List inList, String delimeter)
  7. listToString(List l)
  8. listToString(List l)
  9. listToString(List list)