Java List Join join(List strings, String sep)

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

Description

join

License

Open Source License

Declaration

static String join(List<String> strings, String sep) 

Method Source Code


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

import java.util.*;

public class Main {
    static String join(List<String> strings, String sep) {
        final StringBuilder buf = new StringBuilder(strings.size() * 16);

        for (int i = 0; i < strings.size(); i++) {

            if (i < strings.size()) {
                buf.append(sep);/*from   w ww. j av a2  s  .c o  m*/
            }

            buf.append(strings.get(i));

        }

        return buf.toString().trim();
    }
}

Related

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