VOOZH about

URL: https://www.geeksforgeeks.org/java/abstractcollection-isempty-method-in-java-with-examples/

⇱ AbstractCollection isEmpty() Method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AbstractCollection isEmpty() Method in Java with Examples

Last Updated : 11 Jul, 2025
The isEmpty() method of Java AbstractCollection is used to check and verify if a Collection is empty or not. It returns True if the Collection is empty else it returns False. Syntax:
AbstractCollection.isEmpty()
Parameters: The method does not take any parameter. Return Value: The function returns True if the collection is empty else it returns False. Below program illustrate the use of AbstractCollection.isEmpty() method: Program 1:
Output:
Collection: [4, Geeks, To, TreeSet, Welcome]
Is the collection empty? false
Is the collection empty? true
Program 2:
Output:
Collection: [Welcome, To, Geeks, 4, Geeks, ArrayList]
Is the collection empty? false
Is the collection empty? true
Comment