Java Collection to List toList(Collection addresses, char separator)

Here you can find the source of toList(Collection addresses, char separator)

Description

Format all strings in the collection by using the specified separator.

License

Open Source License

Declaration

static String toList(Collection addresses, char separator) 

Method Source Code

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

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

public class Main {
    /**//  w  w w  .  j a v a  2 s  . com
     * Format all strings in the collection by using the specified separator.
     */
    static String toList(Collection addresses, char separator) {
        StringBuffer buf = new StringBuffer();
        for (Iterator itr = addresses.iterator(); itr.hasNext();) {
            String address = (String) itr.next();
            if (buf.length() > 0)
                buf.append(separator);
            buf.append(address);
        }
        return buf.toString();
    }
}

Related

  1. convertCollectionToList(final Collection collection)
  2. convertCollectionToSQL(List listId)
  3. newList(final Collection elements)
  4. newList(final Collection collection)
  5. newList(final Collection objects)
  6. toList(Collection collection)
  7. toList(Collection collection)
  8. toList(Collection c)
  9. toList(Collection collection)