Java String Join join(final String separator, final String... strings)

Here you can find the source of join(final String separator, final String... strings)

Description

join

License

Open Source License

Declaration

public static String join(final String separator, final String... strings) 

Method Source Code


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

import java.util.*;

public class Main {
    public static String join(final String separator, final String... strings) {

        String output = "";

        for (int i = 0; i < strings.length; i++) {
            String s = strings[i];
            output += s;//from w  w w.  j a  v a2s .  c  o m
            if (i < strings.length - 1) {
                output += separator;
            }
        }

        return output;

    }

    public static String join(String separator, List<String> strings) {
        return join(separator, strings.toArray(new String[strings.size()]));
    }
}

Related

  1. join(Enumeration enumeration, String s)
  2. join(Enumeration values, CharSequence separator)
  3. join(final Collection input, final String link)
  4. join(final String sep, final Iterable strs)
  5. join(final String separator, final Collection objs)
  6. join(final String... arguments)
  7. join(HashMap params, String separator)
  8. join(Iterable arr, String delimeter)
  9. join(Iterable input)