is Any String Empty in an String array - Android java.lang

Android examples for java.lang:array

Description

is Any String Empty in an String array

Demo Code


//package com.java2s;
import java.util.Collection;
import android.text.TextUtils;

public class Main {
    public final static boolean isAnyStringEmpty(String[] array) {
        if (array == null || array.length <= 0)
            return false;

        for (String elem : array) {
            if (TextUtils.isEmpty(elem))
                return true;
        }//from  w ww .jav a  2 s. c o  m

        return false;
    }

    public final static boolean isAnyStringEmpty(
            Collection<String> collection) {
        if (collection == null || collection.isEmpty())
            return false;

        for (String elem : collection) {
            if (TextUtils.isEmpty(elem))
                return true;
        }

        return false;
    }
}

Related Tutorials