Java Collection to String collectionToDelimitedString(Collection values, String delimiter)

Here you can find the source of collectionToDelimitedString(Collection values, String delimiter)

Description

collection To Delimited String

License

Open Source License

Declaration

public static String collectionToDelimitedString(Collection<String> values, String delimiter) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static String collectionToDelimitedString(Collection<String> values, String delimiter) {
        StringBuffer str = new StringBuffer();
        for (String val : values) {
            if (str.length() > 0) {
                str.append(delimiter);//from w w  w . j  av a2 s. c  o m
            }
            str.append(val);
        }
        return str.toString();
    }
}

Related

  1. collectionToDelimitedString(Collection coll, String delim, String prefix, String suffix)
  2. collectionToDelimitedString(Collection col, String del)
  3. collectionToDelimitedString(Collection coll, String delim)
  4. collectionToDelimitedString(Collection coll, String delim)
  5. collectionToDelimitedString(Collection coll, String delim, String prefix, String suffix)
  6. collectionToStr(Collection collection)
  7. CollectionToStr(Collection coll)
  8. collectionToStr(Collection collection)
  9. collectionToString( Collection collection)