94
Java List isEmpty() Method
The isEmpty() method of List interface returns a Boolean value ‘true’ if this list contains no elements.
Syntax
Parameters
NA
Specified By
isEmpty in interface Collection<E>
Return
The isEmpty () method returns the Boolean value ‘true’ if this list contains no elements, else it returns false.
Example 1
Output:
Enter elements as this list is empty.
Example 2
Output:
Elements are already present in this list. List : [null]
Next TopicJava List