Java Collection Concatenate concatCollection(Collection collection)

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

Description

Converts a collection of Strings into one long String.

License

Open Source License

Parameter

Parameter Description
collection The collection you want to get the String from

Return

The String generated from the collection

Declaration

public static String concatCollection(Collection<String> collection) 

Method Source Code

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

import java.util.Collection;

public class Main {
    /**/*from w  w  w.  jav a 2 s .  c  o m*/
     * Converts a collection of Strings into one long String.
     * @param collection The collection you want to get the String from
     * @return The String generated from the collection
     */
    public static String concatCollection(Collection<String> collection) {
        StringBuilder sb = new StringBuilder(collection.size());
        for (String s : collection) {
            sb.append(String.valueOf(s));
        }
        return sb.toString();
    }
}

Related

  1. concat(Collection... collections)
  2. concat(final Collection... collections)
  3. concat(final Collection... collections)
  4. concat(String separator, Collection args)
  5. concat(String[] first, Collection second)
  6. concatElements(final Collection c, final String separator)
  7. concatenate(Collection collections)
  8. concatenate(Collection coll)
  9. concatenate(Collection list)