Java Collection to String convertCollectionToString( Collection strings, String separator)

Here you can find the source of convertCollectionToString( Collection strings, String separator)

Description

convert Collection To String

License

Apache License

Declaration

public static String convertCollectionToString(
            Collection<String> strings, String separator) 

Method Source Code

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

import java.util.Collection;

public class Main {
    public static String convertCollectionToString(
            Collection<String> strings, String separator) {
        String result = "";
        boolean first = true;
        for (String s : strings) {
            if (first) {
                result += s;/*from  ww  w  .  j a  v a2  s  .  c om*/
                first = false;
            } else {
                result += separator + s;
            }
        }
        return result;
    }
}

Related

  1. collectionToStringList(Collection c)
  2. collectionToStringList(Collection list, String delimiter)
  3. commaSeparatedList(Collection objects)
  4. commaSeparatedString(List list, boolean quoteStrings)
  5. convertCollectionToCommaDelimitedString(Collection collection)
  6. convertCollectionToString(Collection coll, String delimiter)
  7. convertEnumsToString(Collection> enums)
  8. convertListToString(Collection list)
  9. convertString(Collection strings)