Java Collection Create createStringFromCollection(Collection svcInterfaces)

Here you can find the source of createStringFromCollection(Collection svcInterfaces)

Description

create String From Collection

License

Open Source License

Declaration

public static String createStringFromCollection(Collection svcInterfaces) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009 EclipseSource and others. All rights reserved. This
 * program and the accompanying materials are made available under the terms of
 * the Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/* w  w w.  j a  v  a  2 s  .c  o m*/
 *   EclipseSource - initial API and implementation
 ******************************************************************************/

import java.util.*;

public class Main {
    private static final String COLLECTION_SEPARATOR = ",";

    public static String createStringFromCollection(Collection svcInterfaces) {
        if (svcInterfaces == null) {
            return null;
        }
        final StringBuffer result = new StringBuffer();
        for (final Iterator i = svcInterfaces.iterator(); i.hasNext();) {
            final String item = (String) i.next();
            result.append(item);
            if (i.hasNext()) {
                result.append(COLLECTION_SEPARATOR);
            }
        }
        return result.toString();
    }
}

Related

  1. createNamedInsert(String tableName, Collection columnNames)
  2. createNewValue(String value, Collection values)
  3. createNominalDescription(Collection values)
  4. createParameterizedWhereClause(Collection columns)
  5. createStringCollection(Class clazz, String... elements)
  6. createTextFromList(Collection list)
  7. createUniqueName(String baseName, Collection names)
  8. stringToCollection(String string)
  9. stringToCollection(String string)