Java Array Empty Check removeEmptyLines(String lines[])

Here you can find the source of removeEmptyLines(String lines[])

Description

remove Empty Lines

License

Open Source License

Declaration

public static ArrayList<String> removeEmptyLines(String lines[]) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    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]);//from w w  w .j  av  a  2 s. co  m
            }
        }
        return result;
    }
}

Related

  1. normalizeTokens(String[] tokens, boolean removeEmpty)
  2. nullOrEmpty(Object[] array)
  3. removeEmpty(String[] strings)
  4. removeEmptyElements(String[] firstArray)
  5. removeEmptyEntries(String[] array)
  6. removeEmptyString(final String[] words)
  7. removeEmptyString(String[] strOrigin)
  8. removeEmptyStrings(String[] data)
  9. removeEmptyStringsInArray(String[] array)