Java List Join join(String sep, List a)

Here you can find the source of join(String sep, List a)

Description

join

License

Open Source License

Declaration

private static String join(String sep, List<String> a) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    private static String join(String sep, List<String> a) {
        return join(sep, a.toArray(new String[0]));
    }//  w  ww .  ja v a2 s . co m

    private static String join(String sep, String... a) {
        if (a.length == 0)
            return "";

        if (a.length == 1)
            return a[0];

        StringBuffer sbuff = new StringBuffer();
        sbuff.append(a[0]);

        for (int i = 1; i < a.length; i++) {
            if (sep != null)
                sbuff.append(sep);
            sbuff.append(a[i]);
        }
        return sbuff.toString();
    }
}

Related

  1. join(String _delimiter, List _strings)
  2. join(String delimiter, List strings)
  3. join(String joiner, List joinees)
  4. join(String joinString, List strings)
  5. join(String joint, List elements)
  6. join(String separator, Collection list)
  7. join(String separator, Collection inputList)
  8. join(String separator, List items)
  9. join(String separator, List objs)