Here you can find the source of join(List
Parameter | Description |
---|---|
target | a parameter |
splite | a parameter |
public static <T> String join(List<T> target, String splite)
//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; } }