Java List Remove removeEmptyLinesOnSides(List lines)

Here you can find the source of removeEmptyLinesOnSides(List lines)

Description

remove Empty Lines On Sides

License

Open Source License

Declaration

public static void removeEmptyLinesOnSides(List<String> lines) 

Method Source Code

//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);
    }
}

Related

  1. removeEmpties(List original)
  2. removeEmpty(List strings)
  3. removeEmptyColumns(List data)
  4. removeEmptyLines(List lines)
  5. removeEmptyLinesFromEnd(List list)
  6. removeEmptyLists(Map map)
  7. removeEmptyStringsFromList(List list)
  8. removeEmptyStringsInList(List list)
  9. removeEmptyTags(List tags)