Java Collection Join joinStrings(Collection names)

Here you can find the source of joinStrings(Collection names)

Description

join Strings

License

Open Source License

Declaration

public static String joinStrings(Collection<String> names) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static String joinStrings(Collection<String> names) {
        StringBuilder sb = new StringBuilder(1000);

        for (String name : names) {
            if (sb.length() > 0) {
                sb.append(", ");
            }/*from w w  w  .j  av a  2  s. co m*/

            sb.append(name);
        }

        return sb.toString();
    }
}

Related

  1. joinSort(Collection c, String separator)
  2. joinSorted(Collection s, String delimiter)
  3. joinString(Collection values, String delimiter)
  4. joinStringCollection(Collection collection, String separator)
  5. joinStrings(Collection strings)
  6. joinStrings(Collection strings)
  7. joinStrings(String delim, Collection strs)
  8. joinStringValues(Collection values)
  9. joinTo(Collection data, String sep, StringBuilder sb)

  10. HOME | Copyright © www.java2s.com 2016