Java List Join join(List strings, String separator)

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

Description

join

License

Open Source License

Declaration

public static String join(List<String> strings, String separator) 

Method Source Code

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

import java.util.*;

public class Main {
    public static String join(List<String> strings, String separator) {
        if (strings == null) {
            return "";
        }/*from ww  w .  ja v  a 2  s.c  o m*/
        StringBuffer sb = new StringBuffer();
        for (int i = 0, m = strings.size(); i < m; i++) {
            String string = strings.get(i);
            if (string == null) {
                string = "";
            }

            sb.append(string);
            if (i + 1 < m) {
                sb.append(separator);
            }
        }
        return sb.toString();
    }
}

Related

  1. join(List strings, String sep)
  2. join(List strings, String separator)
  3. join(List strings, String separator)
  4. join(List strings, String separator)
  5. join(List strings, String separator)
  6. join(List stringsToJoin, char delimiter)
  7. join(List strList, char separator)
  8. join(List strList, String sep)
  9. join(List tokens, String sep)