Here you can find the source of toList(String val, String separator)
public static List<String> toList(String val, String separator)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> toList(String val, String separator) { List<String> list = new ArrayList<String>(); if (!isEmpty(val) && val.indexOf(separator) > -1) { String[] arr = val.split(separator); for (String item : arr) { if (!isEmpty(item)) { list.add(item);/*from w w w.java 2 s.co m*/ } } } return list; } public static boolean isEmpty(String val) { return val == null || val.trim().length() == 0; } }