Java Collection Join join(Collection values)

Here you can find the source of join(Collection values)

Description

join

License

Apache License

Declaration

public static String join(Collection<String> values) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static String join(Collection<String> values) {
        return join(values, ",");
    }//  w w w.j  a  va  2s.c o  m

    public static String join(Collection<String> values, String delimeter) {
        if (values == null) {
            return "";
        }
        StringBuilder builder = new StringBuilder();
        for (String value : values) {
            if (builder.length() != 0) {
                builder.append(delimeter);
            }
            builder.append(value);
        }
        return builder.toString();
    }
}

Related

  1. join(Collection strings, String separator)
  2. join(Collection strings, String separator)
  3. join(Collection strings, String token)
  4. join(Collection strs, String sep)
  5. join(Collection thisPath, String _delim)
  6. join(Collection words, String character)
  7. join(Collection c, String concatinator)
  8. join(Collection coll, String separator)
  9. join(Collection collec, String delimiter)