Home » Java List isEmpty() Method with Examples

Java List isEmpty() Method with Examples

by Online Tutorials Library

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

Test it Now

Output:

Enter elements as this list is empty.  

Example 2

Test it Now

Output:

Elements are already present in this list.  List : [null]  
Next TopicJava List

You may also like