Here you can find the source of collectionToCSString(Collection
Parameter | Description |
---|---|
E | a parameter |
col | a parameter |
public static <E> String collectionToCSString(Collection<E> col)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**// ww w . j av a 2s. co m * Transform collection to comma split string. * * @param <E> * @param col * @return */ public static <E> String collectionToCSString(Collection<E> col) { if (col == null) { return null; } StringBuilder sb = new StringBuilder(); for (E e : col) { sb.append(e).append(","); } if (sb.length() > 0) { sb.delete(sb.length() - 1, sb.length()); } return sb.toString(); } }