Java List Join join(List list)

Here you can find the source of join(List list)

Description

join

License

Apache License

Declaration

public static String join(List<String> list) 

Method Source Code

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

import java.util.List;

public class Main {

    public static String join(List<String> list) {
        String str = "";
        for (int i = 0; i < list.size(); i++) {
            if (i > 0) {
                str += ",";
            }//  w  w w .j a  va  2  s .  co m
            str += "'" + list.get(i) + "'";
        }
        return str;
    }

    public static String join(List<String> list, String separator) {
        String str = "";
        for (int i = 0; i < list.size(); i++) {
            if (i > 0) {
                str += separator;
            }
            str += list.get(i);
        }
        return str;
    }
}

Related

  1. join(List list)
  2. join(List list)
  3. join(List list)
  4. join(List list)
  5. join(List list)
  6. join(List list, String conjunction)
  7. join(List list, String delim)
  8. join(List list, String delim)
  9. join(List list, String delimiter)