Here you can find the source of splitIntoNonEmptyLines(String s)
public static ArrayList<String> splitIntoNonEmptyLines(String s)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static ArrayList<String> splitIntoNonEmptyLines(String s) { return removeEmptyLines(s.split("\n")); }/*ww w. j a v a 2 s. c o m*/ public static ArrayList<String> removeEmptyLines(String lines[]) { ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < lines.length; i++) { if (!lines[i].trim().isEmpty()) { result.add(lines[i]); } } return result; } }