Here you can find the source of removeEmptyLinesOnSides(List
public static void removeEmptyLinesOnSides(List<String> lines)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static void removeEmptyLinesOnSides(List<String> lines) { while (lines.size() > 0 && lines.get(0).trim().length() == 0) lines.remove(0);/*from ww w . jav a2s . c o m*/ while (lines.size() > 0 && lines.get(lines.size() - 1).trim().length() == 0) lines.remove(lines.size() - 1); } }