How to check for empty String array including empty elements

org.apache.commons.lang3.ArrayUtils provides methods to check if Array is empty, but for example for String array which has empty String elementsmeaning character "" it returns true for that isNotEmpty() method, which is correct as that method check only for null and length == 0.

Is there any other method or implementation which checks also if array has empty element ?

I could do it myself, iterate over array and manualy remove such elements of course, but I would better use any library as apache.

Any hints ?


I think you will have to do it manually, perferrably using StringUtils.isNotBlank(str) instead of arrayUtils. So that you don't iterate twice over the array.

With Java 8:

final String[] strings = {"", "Hello", "World"};
final boolean containsEmptyString = Stream.of(strings)
            .anyMatch(string -> string == null || string.isEmpty());

So manual way is maybe only solution here in Java1.6 | 1.7 :

public static boolean isEmpty(String[] array){
    for(String tmp : array){
            return false;
    return true;

StringUtils could be from apache, or own code checking for NULL && length ==0

Need Your Help

Parameters for SOAP client connection

android web-services ksoap2

I use asmx web service for android client application. I need soap_action, method_name, namespace and url for sample SOAP 1.1 request that written below. How can i bring out these parameters for any

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.