Java Collection to String collectionToCommaString(Collection bundleSelection)

Here you can find the source of collectionToCommaString(Collection bundleSelection)

Description

collection To Comma String

License

Open Source License

Declaration

public static String collectionToCommaString(Collection bundleSelection) 

Method Source Code

//package com.java2s;
/*//from w  w w.j a  va 2 s .  c  o m
 * $Id$
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 *
 * The software in this package is published under the terms of the MuleSource MPL
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static String collectionToCommaString(Collection bundleSelection) {
        StringBuffer sb = new StringBuffer();
        for (Iterator it = bundleSelection.iterator(); it.hasNext();) {
            if (sb.length() > 0)
                sb.append(',');
            sb.append(it.next().toString());
        }
        return sb.toString();
    }
}

Related

  1. buildStringFromListForNuma(Collection list)
  2. collectionToCommaDelimitedString(Collection items)
  3. collectionToCommaDelimitedString(Collection list)
  4. collectionToCommaSeparatedString(Collection elementCollection)
  5. collectionToCommaSeparatedString(List list)
  6. collectionToCSString(Collection col)
  7. collectionToDelimitedString( Iterable iterable)
  8. collectionToDelimitedString(Collection c, String delim)
  9. collectionToDelimitedString(Collection coll, String delim)