Java List Join join(List l, String sep)

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

Description

join

License

Open Source License

Declaration

public static String join(List l, String sep) 

Method Source Code


//package com.java2s;
import java.util.List;

public class Main {
    public static String join(String[] fields, String sep) {
        StringBuffer answer = new StringBuffer();
        if (fields != null && fields.length > 0) {
            answer.append(fields[0]);/* w  w  w .  j av a2 s  .  co m*/
            for (int i = 1; i < fields.length; i++) {
                answer.append(sep);
                answer.append(fields[i]);
            }
        }
        return answer.toString();
    }

    public static String join(List l, String sep) {
        String[] fields = (String[]) l.toArray(new String[l.size()]);
        return join(fields, sep);
    }
}

Related

  1. join(List a_quotedArgs)
  2. join(List array, String separator)
  3. join(List elements, String joinWith)
  4. join(List elements, String sep)
  5. join(List items, String separator)
  6. join(List list, char separator)
  7. join(List list, String delim)
  8. join(List list, String delimiter)
  9. join(List list, String flag)