![]() |
VOOZH | about |
The isEmpty() of java.util.Collection interface is used to check if the Collection upon which it is called is empty or not. This method does return a boolean value indicating whether the collection is empty or not. Here's the correct information for the isEmpty() method:
Syntax:
boolean isEmpty()Parameters:
This method does not accept any parameter.
Return Value:
This method returns a boolean value, which indicates whether the collection is empty or not. The below examples illustrate the Collection isEmpty() method:
The list is: [Geeks, for, Geeks] Is the LinkedList empty: false The new List is: [] Is the LinkedList empty: true
ArrayDeque: [Welcome, To, Geeks, 4, Geeks] Is the ArrayDeque empty: false The new ArrayDeque is: [] Is the ArrayDeque empty: true
ArrayList: [15, 20, 25] Is the ArrayList empty: false The new ArrayList is: [] Is the ArrayList empty: true
Reference:
https://docs.oracle.com/javase/9/docs/api/java/util/Collection.html#isEmpty--