Here you can find the source of stringToCollection(String string)
public static Collection<String> stringToCollection(String string)
//package com.java2s; /**/*from w w w .j a v a2s . c o m*/ * <p> * Simple utility class for String operations useful across the framework. * <p/> * <p> * Some methods in this class were copied from the Spring Framework so we didn't * have to re-invent the wheel, and in these cases, we have retained all * license, copyright and author information. * * @since 0.9 */ import java.util.*; public class Main { /** * Returns a comma-delimitted list of Strings as a Collection. * * @return a Collection representing the String. */ public static Collection<String> stringToCollection(String string) { if (string == null || string.trim().length() == 0) { return Collections.emptyList(); } Collection<String> collection = new ArrayList<String>(); StringTokenizer tokens = new StringTokenizer(string, ","); while (tokens.hasMoreTokens()) { collection.add(tokens.nextToken().trim()); } return collection; } }