![]() |
VOOZH | about |
In Java, the isEmpty() method of ArrayList is used to check if an ArrayList is empty.
Example 1: Here, we use the isEmpty() method to check whether an ArrayList of integers is empty.
true false
isEmpty() Methodpublic boolean isEmpty()
Return Type: It returns a boolean value, true if the list is empty, otherwise false.
Example 2: Here, we use the isEmpty() method to check if an ArrayList of strings is empty.
true false
Example 3: Here, we will use the isEmpty() method to check if an ArrayList of Objects is empty.
true false