Here you can find the source of splitToList(final String listString, final String split)
public static List<String> splitToList(final String listString, final String split)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> splitToList(final String listString, final String split) { return splitToList(listString, split, false); }//from w ww.j a va 2 s. c o m public static List<String> splitToList(final String listString, final String split, boolean ignoreNullString) { if (listString == null) { return new ArrayList<String>(0); } if (split == null || split.length() == 0) { return new ArrayList<String>(0); } List<String> result = new ArrayList<String>(); String tmpListString = listString.trim(); String[] array = tmpListString.split(split); for (String str : array) { str = str.trim(); if (!"".equals(str)) { if (ignoreNullString && "NULL".equals(str)) { continue; } result.add(str); } } return result; } }