Java List Join join(List strings, String separator)

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

Description

join

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static String join(List<String> strings, String separator) {
        StringBuilder sb = new StringBuilder();
        boolean first = true;

        for (String string : strings) {
            if (!first) {
                sb.append(separator);/*w  ww. j  a  v  a2  s  . c om*/
            } else {
                first = false;
            }
            sb.append(string);
        }

        return sb.toString();
    }
}

Related

  1. join(List strings, String delim)
  2. join(List strings, String delimiter)
  3. join(List strings, String join)
  4. join(List strings, String joiner)
  5. join(List strings, String sep)
  6. join(List strings, String separator)
  7. join(List strings, String separator)
  8. join(List strings, String separator)
  9. join(List strings, String separator)