Java List Join join(List target, String splite)

Here you can find the source of join(List target, String splite)

Description

join

License

Open Source License

Parameter

Parameter Description
target a parameter
splite a parameter

Declaration

public static <T> String join(List<T> target, String splite) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**/*from   ww  w .j  a v a 2s  . c o m*/
     * @param target
     * @param splite
     * @return
     */
    public static <T> String join(List<T> target, String splite) {
        String rs = "";
        StringBuilder ret = new StringBuilder();
        for (T t : target) {
            ret.append(t).append(splite);
        }
        if (ret.lastIndexOf(",") > 0) {
            rs = ret.substring(0, ret.lastIndexOf(","));
        }
        return rs;
    }
}

Related

  1. join(List list, String delimiter)
  2. join(List list, String joiner)
  3. join(List list, String separator)
  4. join(List objects, String separator)
  5. join(List objs, String delim)
  6. join(List tokens, String delimiter)
  7. join(List values, String separator)
  8. join(List... lists)
  9. join(List... ls)