Returns true if this List contains no elements.
Syntax
boolean isEmpty()
Parameters
None
Return Value
True or false depending on whether the list is empty or not.
Example
Following is an example of the usage of this method −
class Example { static void main(String[] args) { def lst = [11, 12, 13, 14]; def emptylst = []; println(lst.isEmpty()); println(emptylst.isEmpty()); } }
When we run the above program, we will get the following result −
false true
Previous Page:-Click Here