Java - Write code to check if all elements in an array is Empty String

Requirements

Write code to check if all elements in an array is Empty String

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String[] line = new String[] { "1", "abc", "level", null,
                "book2s.com", "asdf 123" };
        System.out.println(allEmptyString(line));
    }//w  ww  .j a va2s  . c  o  m

    public static boolean allEmptyString(String[] line) {
        for (String string : line) {
            if (string != null && !string.isEmpty()) {
                return false;
            }
        }
        return true;
    }

    public static boolean isEmpty(String[] line) {
        return line.length == 0 || allEmptyString(line);
    }
}