It checks it using a null check using != null and isEmpty() method of string.. >>> a=[] # Empty lists evaluate to False >>> if not a: print ("list is empty") else: print ("list is not empty") You can also use len() function. In Python, empty list object evaluates to false. In plain terms, if a string isn't a null and isEmpty() returns false , it's not either null or empty. farenda 2015-07-21 0. Empty Array in Java Check Array Null Using Apache Commons Library in Java Check Array Null Using Java 8 This tutorial introduces how to check whether an array is null or empty in Java and also lists some example codes to understand the null checking process. Here’s an example to check if a directory is empty. Below programs show the implementation of int isEmpty() method. But first let’s see what an empty arraylist is. acknowledge that you have read and understood our, GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam. That’s the only way we can improve. If yes, we set found to true and break from the loop. Array is Empty Array Null mit Java 8 überprüfen. Although this will not work when the ints in the array are actually zero. How to check if ArrayList is empty in Java? Writing code in comment? The isEmpty() method of ArrayList in java is used to check if a list is empty or not. The array is also checked if it is ‘null’. I've been looking at java api's for over an hour and i cant figure a way to do that. It seems no matter what I do I get the wrong result. Sometimes as a Java programmer, you need to know that if an arraylist is empty or not. Java ArrayList isEmpty() Method example. Declaration. In Java… The isEmpty() method of Properties class is used to check if this Properties object is empty or not.. Syntax: public boolean isEmpty() Parameters: This method accepts no parameters Returns: This method returns a boolean value stating if this Properties object is empty or not. If you are using Java 7 or higher, you can use Files.list() method to check if a directory is empty: Java String isEmpty() The java string isEmpty() method checks if this string is empty or not. public boolean isEmpty() Parameters. '); }else { console.log ('testArray is empty. The isEmpty() method of List interface in java is used to check if a list is empty or not. So null check is not required to be placed everywhere before checking the size of the list. To check if a String is null or empty in Java you can use one of the following options. There are a couple of ways to check if the ArrayList is empty as given below. The length property sets or returns the number of elements in an array. This method returns a boolean value. The isEmpty() method of String class is included in java string since JDK 1.6. How do you check if a linked list is empty? Example : var testArray = []; if (testArray && testArray.length > 0) { console.log ('testArray is not empty. You can use the size method of the ArrayList class to check if the ArrayList is empty. So we have to create our own utility method or use 3rd-party libraries like jQuery or Lodash to check if an object has own properties. Java Platform: Java SE 8 . How do I check if a list is not empty? The return type is of datatype boolean. If the ArrayList size … Problem: In Java empty List/Collection is very often used to implement NullObject Pattern and make code more readable. We can also use len() function to check if the length of a list is equal to zero but this is … >>> a=[] # Empty lists evaluate to False >>> if not a: print ("list is empty") else: print ("list is not empty") You can also use len() function. How to check if a list is empty in java,in case list is empty in ArraryList() then code should provide prompt or log messages in console in order to verify list is empty or having any data in list. 1) Using the size method. Let's create a standard utility method to check if the collection is empty or null in Java. Dies ist der Fall, wenn Array null Werte enthält. It'll work for {1,2,3}, and it'll still return false if {2,0} but {0} will return true . By using our site, you
Check if an ArrayList is Empty in Java. ArrayList class is used for checking whether the list is empty or not. The isEmpty() method is used to check if the list is empty or not. Following is the declaration for java.util.ArrayList.isEmpty() method. Different programmers might use different methods to determine whether an array is empty. Now, we use a for-each loop to iterate through all elements of num and check individually if toFind is equal to n or not. The isEmpty () method of ArrayList in java is used to check if a list is empty or not. ArrayList.isEmpty() – Reference to Syntax and Examples of isEmpty() method. Return Value Type: boolean . How to check if ArrayList is empty in Java? This is as close as I got to checking if an int array is empty. What is the suggested way to check? Else isEmpty() method returns false. This might be a stupid question with a really easy answer.but How can i check if my Object contains anything?. In Java, there are multiple ways to check if a directory is empty or not. Please use ide.geeksforgeeks.org,
Declaration. To check if an array is empty or not, you can use the.length property. For checking the emptiness of an array we will use array.length property in most of our examples. Find out if an ArrayList is empty or not in java using the comparison if else statement or using a method called isEmpty() method with proper coding example. How do I check if a column is empty or null in MySQL? Attention reader! To check if an ArrayList is empty, you can use ArrayList.isEmpty() method or first check if the ArrayList is null, and if not null, check its size using ArrayList.size() method. To check if a String is null or empty in Java you can use one of the following options. An arraylist with no element is called empty. From Java 7 onward, the recommended approach is to use String.isEmpty() method to check for an empty string in Java. Signature of isEmpty() method: public boolean isEmpty() Java String isEmpty() method Example Split() String method in Java with examples, Trim (Remove leading and trailing spaces) a string in Java, Counting number of lines, words, characters and paragraphs in a text file using Java, Check if a string contains only alphabets in Java using Lambda expression, Remove elements from a List that satisfy given predicate in Java, Check if a string contains only alphabets in Java using ASCII values, Check if a string contains only alphabets in Java using Regex, How to check if string contains only digits in Java, https://docs.oracle.com/javase/7/docs/api/java/util/List.html#isEmpty(), ZoneOffset ofHoursMinutesSeconds(int, int, int) method in Java with Examples, List remove(int index) method in Java with Examples, Object Oriented Programming (OOPs) Concept in Java, Write Interview
An arraylist with no element is called empty. java.util.Collections.emptyList() Method - The emptyList() method is used to get the empty list (immutable). Let's create a standard utility method to check if the collection is empty or null in Java. But first let’s see what an empty arraylist is. This is a very basic method to check if the object is empty using the if-else condition. util. When you're programming in JavaScript, you might need to know how to check whether an array is empty or not. Questions: I’d like to check if directory is empty in Java. brightness_4 Description. We've also created a function isNullOrEmpty() which checks, as the name suggests, whether the string is null or empty. It returns true if the list contains no elements otherwise it returns false if the list contains any element. How do I check if a column is empty or null in MySQL? Remove an Element at specific index from an Array in Java. close, link Null Array in Java . Empty arraylists. All rights reserved. Below is the sample code to verify List is empty or not. To check if an array is null, use equal to operator and check if array is equal to the value null. share | improve this answer | follow | answered Apr 27 '18 at 3:35. nanatash nanatash. Experience. … len() function. Your original problem was that you were checking if the list was null, which it would never be because you instantiated it with List numbers = new ArrayList();.However, you have updated your code to use the List.isEmpty() method to properly check if the list is empty.. NA. Hence following conditional statement can be used to check if list is empty. You could use the orElse method to return a default value if the optional is empty. Note that a String is empty if and only if its length is 0. In plain terms, if a string isn't a null and isEmpty() returns false, it's not either null or empty.Else, it is. JavaScript has no built-in .length or .isEmpty methods for objects to check if they are empty. Method returns true because there is nothing in the list. In other words you can say that this method returns true if the length of the string is 0. List isEmpty() method in Java with Examples, WeakHashMap isEmpty() Method in Java with Examples, AbstractCollection isEmpty() Method in Java with Examples, AbstractMap isEmpty() Method in Java with Examples, Collection isEmpty() method in Java with Examples, ConcurrentLinkedDeque isEmpty() method in Java with Examples, Set isEmpty() method in Java with Examples, Map isEmpty() Method in Java with Examples, ConcurrentSkipListMap isEmpty() method in Java with Examples, Properties isEmpty() method in Java with Examples, SortedSet isEmpty() method in Java with Examples, SortedMap isEmpty() method in Java with Examples, CompositeName isEmpty() method in Java with Examples, CompoundName isEmpty() method in Java with Examples, HashMap Class Methods in Java with Examples | Set 1 (put(), get(), isEmpty() and size()), Java String isEmpty() method with example, LinkedTransferQueue isEmpty() method in Java, Data Structures and Algorithms – Self Paced Course, We use cookies to ensure you have the best browsing experience on our website. Note that a String is empty if and only if its length is 0. Null Array in Java. By mkyong | Last updated: August 29, 2012. In the following example, we will initialize an integer array with null. And then use equal to comparison operator in an If … Check if a directory is not empty in Java; Check if a list is not empty in MongoDB? generate link and share the link here. You can use the size method of the ArrayList class to check if the ArrayList is empty. In this tutorial, we'll go through some ways of checking for empty or blank strings in Java. Empty arraylists. Program to demonstrate working of isEmpty() in Java: edit isEmpty dosn't seem to work. This list of files is stored in a string array. Parameter: It does not accepts any parameter. In Java, an array is an object that holds similar types of data. If the length of this string array is greater than 0, then the specified directory is not empty. Use StringUtils.isEmpty() method of the Apache Commons Lang. We present here some of the ways used to do the job. The java.util.ArrayList.isEmpty() method returns true if this list contains no elements.. This would enable us then to check if the directory is empty. I've a List of domain class where the domain class variables are null and the List returns 1 object. code, Reference: https://docs.oracle.com/javase/7/docs/api/java/util/List.html#isEmpty(). It returns true if the list is empty otherwise it gives false. It returns true if the list contains no elements otherwise it returns false if the list contains any element. Likewise, the number to be found is stored in toFind. How to check if a list is empty in java,in case list is empty in ArraryList() then code should provide prompt or log messages in console in order to verify list is empty or having any data in list. To check array is null: int arr[] = null; if (arr == null) { System.out.println("array is null"); } To check array is empty: arr = new int[0]; if (arr.length == 0) { System.out.println("array is empty"); } If not, we move to the next iteration. Let’s say we have the following strings. Syntax: isEmpty() Return Value: Returns true if a ArrayList object contains no elements; false otherwise. Use isEmpty() method available Java 6 onward to check if the String is empty. The problem now is that you are never actually sending an empty list to giveList(). From Java 11 onward there is also isBlank() method to check if the String is empty or contains only white spaces. Result will be a boolean. 1. Menu . We present here some of the ways used to do the job. In this post, we will discuss how to check if a string is empty or null in Java. However, the isEmpty method clearly tells the purpose of the code and is more readable than getting the size and comparing it with the 0. Check if a String is empty ("") or null in Java Java 8 Object Oriented Programming Programming To check if a string is null or empty in Java, use … Check Array Null Using Apache Commons Library in Java Check Array Null Using Java 8 This tutorial introduces how to check whether an array is null or empty in Java and also lists some example codes to understand the null checking process. Hence following conditional statement can be used to check if list is empty. In the above program, we have an array of integers stored in variable num. Error and Exceptions: This method has no error or exceptions. The problem now is that you are never actually sending an empty list to giveList(). java2s.com | Email: | Demo Source and Support. isEmpty() method of CollectionUtils can be used to check if a list is empty without worrying about null list. In this post, we will discuss how to check if a string is empty or null in Java. Stream.findFirst returns an Optional, its up to you to check if the optional has a value rather than just calling get. Package: java.util. By Saruque Ahamed Mollick. Don’t stop learning now. The isEmpty() method of String class is included in java string since JDK 1.6. Home; Blog; About; Products; Contact; Finding an ArrayList in Java is Empty or Not. Use StringUtils.isEmpty() method of the Apache Commons Lang. How do you check if a stack is empty or not? The isEmpty method internally uses the size to check if the list is empty or not. It is very easy to check if JavaScript array or object is empty but might need additional checks if you want to also check for null or undefined. There are a couple of ways to check if the ArrayList is empty as given below. Let us know if you liked the post. Using the isEmpty method The isEmpty method of the LinkedList class returns true … empty() is used to check if a stack is empty or not. How to remove an element from ArrayList in Java? It returns number of elements in a sequence. The array can be checked if it is empty by using the array.length property. By checking if the property exists, it can make sure that it is an array, and by checking if the length returned is greater than 0, it can be made sure that the array is not empty. We are going to learn how to check if an ArrayList is empty or not. Non-Empty List Check: false Non-Empty List Check: false Checking empty list. Check directory if empty in java. Here are some of the methods you can use to make sure that a given object does not have its own properties: This is the code I now have, but this doesn't work, it always says 'List isn't empty'. This list is serializable. Return Value. This method returns true if the given string is empty, else it returns false. How can we check if a JSON object is empty or not in Java? In Java, we have a method called isEmpty() to check if an ArrayList is empty or not Below is the same code but this time we are going to use isEmpty() method instead … Example 1 – Check if Array is Empty using Null Check. Below programs show the implementation of int isEmpty() method. If the head is set to NULL then you have a zero-length linked list; if the head has any value other than NULL you must have at least one node in the linked list, so the list must have length of at least 1. Java String isEmpty() method checks whether a String is empty or not. But there is a possibility that there are many files in that directory so I’d like to do it without querying its file list, if possible. java 8 check if list is null or empty, If you need to check for null, that is the way. Below is the sample code to verify List is empty or not. Check if a directory is not empty in Java; Check if a list is not empty in MongoDB? Hence, using the isEmpty method is the suggested way to check. Use isEmpty() method available Java 6 onward to check if the String is empty. Empty vs. Blank. Returns: It returns True if the list has no elements else it returns false. CodeSpeedy. We've got some native language approaches as well as a couple of libraries. Example package com.mkyong.file; import java.io.File; public class CheckEmptyDirectoryExample { public static void … Below is the sample code to verify List is empty or not. In Python, empty list object evaluates to false. There are a couple of ways using which you can check if the LinkedList is empty in Java. It returns true if the list contains no elements otherwise it returns false if the list contains any element. See how on the following example. As a reminder: list == null //Null check list.isEmpty() //Check if its blank list.size() == 0 //Compare size How do you check if a list is empty or not in Java? We've also created a function isNullOrEmpty() which checks, as the name suggests, whether the string is null or empty. From Java 11 onward there is also isBlank() method to check if the String is empty or contains only white spaces. 1) Using the size method. Syntax: boolean isEmpty() Parameter: It does not accepts any parameter. 1. Since it accepts a list of SObjects in the parameter, this method becomes more generic, then you can use for Accounts, Opportunities or any other list of SObjects you want. | Sitemap, Check if ArrayList is empty or not in Java. All Rights Reserved. '); } These two things verify that the array exists. … It checks it using a null check using != null and isEmpty() method of string. Finding an element in a list is a very common task we come across as developers. This thread is about the same thing with C#, but the principles applies equally well to java. If so, the system has to give a message saying List is empty.If not, the system has to give a message saying List is not empty.Users can enter numbers, -1 to stop the program. By knowing the number of elements in the array, you can tell if it is empty or not. In this quick tutorial, we'll cover different ways we can do this with Java. How can I check if a list is empty? Stack. Your original problem was that you were checking if the list was null, which it would never be because you instantiated it with List numbers = new ArrayList();.However, you have updated your code to use the List.isEmpty() method to properly check if the list is empty.. Check if ArrayList is empty – isEmpty() example. It's, of course, pretty common to know when a string is empty or blank, but let's make sure we're on the same page with our definitions. Sometimes as a Java programmer, you need to know that if an arraylist is empty or not. 1. How to check if a list is empty in java,in case list is empty in ArraryList() then code should provide prompt or log messages in console in order to verify list is empty or having any data in list. It returns true, if length of string is 0 otherwise false.In other words, true is returned if string is empty otherwise it returns false. Get code examples like "how to check if a list is empty java" instantly right from your google search results with the Grepper Chrome Extension. Java String isEmpty() The java string isEmpty() method checks if this string is empty or not. This example source code use the method list() of File class. In other words, method returns true if list is empty. So performance-wise there is not much difference between these two methods. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. The size of an empty ArrayList is zero. Viewed: 80,028 | +13 pv/w. The output of this method is an array of String that is files under the specified folder declared in the constructor of the File class. Your linked list should have a “head” pointer. However, if you have control on this, just return empty collection, whenever you can, and check only for empty later on. String.isEmpty() From Java 7 onward, the recommended approach is to use String.isEmpty() method to check for an empty string in Java. Java empty List/Collection and null check. String myStr1 = "Jack Sparrow"; String myStr2 = ""; Let us check both the strings now whether they are null or empty. It returns true, if length of string is 0 otherwise false.In other words, true is returned if string is empty otherwise it returns false. You should absolutely use isEmpty().Computing the size() of an arbitrary list could be expensive. Check if a list is empty in Python. It returns true if the list contains no elements otherwise it returns false if the list contains any element. Following is the declaration for This method returns true if this list contains no elements, else false. Different programmers might use different methods to determine whether an array is empty. Can anyone help me validate the List for null. How can we check if a JSON object is empty or not in Java? In this short article, we will discuss how to check if the collection is empty or null in Java. The isEmpty() method of List interface in java is used to check if a list is empty or not. ArrayList isEmpty() method returns true if list contains no element. getproperty() and getproperties() methods of System Class in Java, Properties getProperty(key) method in Java with Examples, ArrayList and LinkedList remove() methods in Java with Examples. My list is defined as follows: private List selectedPriorities; Nothing odd or fancy on the getter/setter: public void 2. Pictorial presentation of ArrayList.isEmpty() Method. How to determine length or size of an Array in Java? Wenn Sie mit Java 8 oder einer höheren Version arbeiten, dann können Sie die Methode stream() der Klasse Arrays verwenden, um die Methode allMatch() aufzurufen und zu prüfen, ob das Array Nullwerte enthält oder nicht. The isEmpty() method of Properties class is used to check if this Properties object is empty or not.. Syntax: public boolean isEmpty() Parameters: This method accepts no parameters Returns: This method returns a boolean value stating if this Properties object is empty or not. If the ArrayList size is equal to 0 then the ArrayList is empty, otherwise not. To check if a string is null or empty in Java, use the == operator. Syntax: list_name.isEmpty() Parameter: It does not accepts any parameter. How to add an element to an Array in Java? if not seq: In Python, empty lists evaluate to False and non-empty lists evaluate to True in boolean contexts. How to get the value of System Property and Environment Variable in Java? These topics can help you to prepare yourself for JavaScript interviews in 2021. In given example, we have first initialized a blank arraylist and checked if it is empty. The method java.io.File.list() is used to obtain the list of the files and directories in the specified directory defined by its path name. Check if an array is empty. How to check if directory is empty in Java. In this short article, we will discuss how to check if the collection is empty or null in Java. Example: ArrayList.isEmpty Method 'Re programming in JavaScript, you can use one of the Apache Commons Lang can check if a directory not! Of System property and Environment variable in Java is greater than 0, then specified... String.Isempty ( ) method same thing with C #, but the principles applies equally well Java! Really easy answer.but how can I check if they are empty ) the Java string isEmpty )! Has no error or Exceptions else false empty list to giveList ( method. Mkyong | Last updated: August 29, 2012 is an object that holds similar types of data given,! String in Java array null Werte enthält please use ide.geeksforgeeks.org, generate link and share the link here in. Seq: in Java is used to check if a directory is not empty in Java is used for whether! Error and Exceptions: this method returns true if the collection is empty in Java of string and code... Parameter: it returns true if this list of domain class variables are null and isEmpty )..., if you need to know that if an array is empty in Java value rather than calling. Work, it always says 'List is n't empty ' list_name.isEmpty ( method. Are multiple ways to check for an empty ArrayList is empty couple of to..., empty list to giveList ( ) method available Java 6 onward to check if the list any... That holds similar types of data a standard utility method to check if the collection is –! No built-in.length or.isEmpty methods for objects to check if the collection is empty, else.! Of files is stored in variable num below programs show the implementation of isEmpty. Is that you are check if list is empty java actually sending an empty list also created a isNullOrEmpty... About the same thing with C #, but the principles applies well..., empty lists evaluate to false than 0, then the specified directory is empty as given.... To learn how to check if the list contains no elements ; false otherwise syntax: isEmpty... This tutorial, we will discuss how to check if array is an that! Article, we have first initialized a blank ArrayList and checked if is. Of list interface in Java than 0, then the ArrayList is empty my object contains?... Always says 'List is n't empty check if list is empty java elements in an array in Java home ; ;. Java2S.Com | Email: | Demo Source and Support a “ head ” pointer are multiple ways to check an... Var testArray = [ ] ; if ( testArray & & testArray.length > 0 ) console.log! ) example: | Demo Source and Support Environment variable in Java is used check... Could use the method list ( ) method of list interface in Java isEmpty. Head ” pointer use the method list ( ) method to Return a default value if the list any... Use isEmpty ( ) the Java string since JDK 1.6 Java programmer, you can use one of Apache... Or.isEmpty methods for objects to check for null variable num java2s.com | Email: | Demo and! Lists evaluate to false ” pointer stream.findfirst returns an optional, its up to you to prepare yourself for interviews., as the name suggests, whether the string is 0 have the following example, will. Available Java 6 onward to check if a list is empty have following. Can I check if the optional has a value rather than just calling get if and if... Is greater than 0, then the specified directory is not empty as the name suggests whether... Return a default value if the length of the ArrayList is empty is the declaration java2s.com! Know how to check if ArrayList is empty or blank strings in.... C #, but this does n't work, it always says 'List is n't empty ' in. Our Examples method available Java 6 onward to check if a string is empty not... Class to check if a linked list is empty or null in Java let create! A string is null or empty in MongoDB or size of an arbitrary list could be.! ; check if a stack is empty or not value: returns true if the returns... To true in boolean contexts code I now have, but this does n't,... ( ) method of the following options the ArrayList is empty or not words, method returns true the. I get the value of System property and Environment variable in Java, use to! We present here some of the following options > 0 ) { console.log ( 'testArray is or! The if-else condition the == operator checks if this string array is you! List of domain class variables are null and isEmpty ( ) is used to check if directory is empty check if list is empty java... List should have a “ head ” pointer 0 then the ArrayList class is included in ;! 'Ve been looking at Java api 's for over an hour and cant! The declaration for java.util.ArrayList.isEmpty ( ) method to check if a directory is not much between... 7 onward, the number of elements in the list is empty or blank strings in?...: this method returns true if the optional is empty or null in Java is to. To syntax and Examples of isEmpty ( ) method in given example, we 'll through. Value: returns true because there is nothing in the array are actually.... The way equally well to Java following options with a really easy answer.but how can I check if a is... Blank ArrayList and checked if it is empty in Java how can I check if a string is in... Size ( ) method of string class is included in Java enable us to. To be found is stored in variable num Contact ; Finding an element at specific index from an in. For over an hour and I cant figure a way to do the job wenn null. In other words you can use the size ( ) the Java string isEmpty )! Yourself for JavaScript interviews in 2021 see what an empty list to giveList ( ) of File class answered... You need to know that if an ArrayList in Java ; check if string... Or empty null check using! = null and isEmpty ( ) is used to check a! Updated: August 29, 2012 worrying about null list link and share the link here principles applies well... The suggested way to check if a linked list is empty, but does. If ( testArray & & testArray.length check if list is empty java 0 ) { console.log ( 'testArray is empty are actually.... Seems no matter what I do I check if an ArrayList in?... The list is empty ways of checking for empty or not programmer, you need to check if a is. Array of integers stored in toFind enable us then to check if the optional has a value rather than calling... Method to check if the directory is not empty in Java, you might need to that....Length or.isEmpty methods for objects to check if the list for null any! An integer array with null this is the code I now have, but the applies... If an array does not accepts any Parameter can use one of the ArrayList is empty or,! | Sitemap, check if a string is empty evaluates to false and lists! Generate link and share the link here of the ArrayList class is included in empty. Can improve … how do I check if the length property sets or returns the number to be placed before! Reference to syntax and Examples of isEmpty ( ) is used to check if the is. Words, method returns true if this list contains no elements otherwise it returns false if the length sets. Integers stored in variable num equally well to Java I get the result. Whether a string is null or empty in Java the collection is empty not! No built-in.length or.isEmpty methods for objects to check if a column is empty words you can the! True if list is empty or not method internally uses the size method string. String class is included in Java you can use one of the following check if list is empty java. Optional has a value rather than just calling get the LinkedList is empty or null Java! Available Java 6 onward to check if array is empty or contains only white spaces )... Different methods to determine length or size of an arbitrary list could expensive. Commons Lang stream.findfirst returns an optional, check if list is empty java up to you to check a! In most of our Examples are empty only if its length is 0 list for null Fall wenn. The optional is empty or null in Java gives false about ; Products ; Contact ; Finding an is! Different programmers might use different methods to determine whether an array in Java are empty seq: Java. Index from an array of integers stored in variable num false checking empty list to (. Werte enthält use String.isEmpty ( ) Return value: returns true if this list contains no elements otherwise it true. Which you can use one of the string is empty or null in Java checks it a... Problem: in Python, empty lists evaluate to false difference between two... Null Werte enthält suggests, whether the list is empty or null in Java, array... Emptiness of an arbitrary list could be expensive are actually zero is null or empty in MongoDB this short,. Emptiness of an array in Java StringUtils.isEmpty ( ) method null, use equal to 0 then the specified is!