Java Collection to String collectionToString(Collection c, String separator)

Here you can find the source of collectionToString(Collection c, String separator)

Description

collection To String

License

Open Source License

Declaration

public static String collectionToString(Collection<?> c, String separator) 

Method Source Code

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

import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static String collectionToString(Collection<?> c, String separator) {
        Iterator<?> i = c.iterator();
        StringBuffer sb = new StringBuffer();
        boolean isNext = false;
        while (i.hasNext()) {
            if (isNext) {
                sb.append(separator);//from w w w .  j a v  a2s . c  om
            } else {
                isNext = true;
            }
            sb.append(i.next());
        }
        return sb.toString();
    }
}

Related

  1. collectionToString(Collection list, String delimiter)
  2. collectionToString(Collection c)
  3. collectionToString(Collection c)
  4. collectionToString(Collection c)
  5. collectionToString(Collection c)
  6. collectionToString(Collection coll, String connectSymbol)
  7. collectionToString(Collection collection, String separator)
  8. collectionToString(Collection collection, String separator)
  9. collectionToString(Collection elements)