Here you can find the source of toCommaSeparatedString(final Collection extends Object> items)
Parameter | Description |
---|---|
items | a parameter |
public static String toCommaSeparatedString(final Collection<? extends Object> items)
//package com.java2s; import java.util.*; public class Main { public static final String COMMA_SPACE_SEPARATOR = ", "; /**//from w ww . j a v a 2 s.c om * Returns string containing item names, each separated from other with * comma and space. Names are obtained via toString() method. * * @param items * @return */ public static String toCommaSeparatedString(final Collection<? extends Object> items) { String result = ""; for (final Iterator<? extends Object> iter = items.iterator(); iter.hasNext();) { result += iter.next(); if (iter.hasNext()) { result += COMMA_SPACE_SEPARATOR; } } return result; } }