Here you can find the source of splitToList(String s, String delimRegEx)
public static List<String> splitToList(String s, String delimRegEx)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static List<String> splitToList(String s, String delimRegEx) { List<String> l = new ArrayList<String>(); if (!isEmpty(s)) { if (isEmpty(delimRegEx)) { l.add(s);//from w w w. j ava 2 s . co m } else { String[] parts = s.split(delimRegEx); l = Arrays.asList(parts); } } return l; } /** Returns true if string is null or zero-length */ public static boolean isEmpty(String s) { return (s == null || s.trim().length() == 0); } }