Java Collection Concatenate concatenateWithComma(Collection collection)

Here you can find the source of concatenateWithComma(Collection collection)

Description

concatenate With Comma

License

Open Source License

Declaration

public static String concatenateWithComma(Collection<String> collection) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static String concatenateWithComma(Collection<String> collection) {
        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (String ss : collection) {
            if (!first) {
                sb.append(", ");
            } else {
                first = false;/*from  ww w  .j a v  a 2 s  .  c  o m*/
            }
            sb.append(ss);
        }
        return sb.toString();
    }
}

Related

  1. concatenate(Collection coll)
  2. concatenate(Collection list)
  3. concatenate(final Collection objects, final String separator)
  4. concatenatedLTL(Collection ltl)
  5. concatenateIds(final Collection ids)
  6. concatEntries(Collection coll, String sep, String lastSep)
  7. concatInt(Collection collection)
  8. concatNames(Collection cNames, String split)
  9. concatNumber(Collection keys)