Java List Join join(final String delimiter, List values)

Here you can find the source of join(final String delimiter, List values)

Description

Join values to string

License

Open Source License

Parameter

Parameter Description
delimiter a parameter
values a parameter

Return

String

Declaration

public static String join(final String delimiter, List<?> values) 

Method Source Code

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

import java.util.List;

public class Main {
    /**/*w w w .j a  v  a2  s.co  m*/
     * Join values to string
     * @param delimiter
     * @param values
     * @return String
     */
    public static String join(final String delimiter, List<?> values) {
        final StringBuilder sb = new StringBuilder();

        for (final Object v : values) {
            if (sb.length() > 0) {
                sb.append(delimiter);
            }

            sb.append(v);
        }

        return sb.toString();
    }
}

Related

  1. join(final List list, final String sepa)
  2. join(final List path, final char delimiter)
  3. join(final List strings, final String delimiter)
  4. join(final List strings, final String separator)
  5. join(final List substrings, final String join)
  6. join(final String separator, final List list)
  7. join(final String with, final List array)
  8. join(Iterable list)
  9. join(Iterable list, String delimiter)