Here you can find the source of toList(String list)
public static ArrayList toList(String list)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static ArrayList toList(String list) { // TODO Auto-generated method stub ArrayList l = new ArrayList(); String aux;//from www . ja v a2 s . c o m aux = list; while (aux.indexOf(',') > 0) { l.add(aux.substring(0, aux.indexOf(',')).trim()); aux = aux.substring(aux.indexOf(',') + 1); } if (aux.trim().compareTo("") != 0) { l.add(aux.trim()); } return l; } public static ArrayList toList(String[] list) { // TODO Auto-generated method stub ArrayList l = new ArrayList(); for (int i = 0; i < list.length; i++) { l.add(list[i]); } return l; } public static ArrayList toList(String list, String sep) { // TODO Auto-generated method stub ArrayList l = new ArrayList(); String aux; aux = list; while (aux.indexOf(sep) > 0) { l.add(aux.substring(0, aux.indexOf(sep)).trim()); aux = aux.substring(aux.indexOf(sep) + 1); } if (aux.trim().compareTo("") != 0) { l.add(aux.trim()); } return l; } }