Here you can find the source of splitToList(String s, String regex)
public static List<String> splitToList(String s, String regex)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> splitToList(String s, String regex) { List<String> list = new ArrayList<String>(); for (String item : s.split(regex)) { if (!item.isEmpty()) { list.add(item);/* w ww. j a va 2s .c o m*/ } } return list; } }