AbstractSet isEmpty() method in Java with Example Last Updated : 24 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The isEmpty() method of AbstractSet in Java is used to check whether this AbstractSet is empty or not. It returns an boolean value stating the same. Syntax: public boolean isEmpty() Parameters: This function has no parameters. Returns: The method returns an boolean value which states that this instance of the AbstractSet is empty or not. Below examples illustrates the AbstractSet.isEmpty() method: Example 1: Java // Java code to demonstrate the working of // isEmpty() method in AbstractSet import java.util.*; public class GFG { public static void main(String[] args) { // creating an AbstractSet AbstractSet<Integer> arr = new TreeSet<Integer>(); // using add() to initialize values // [1, 2, 3, 4] arr.add(1); arr.add(2); arr.add(3); arr.add(4); // print AbstractSet System.out.println("AbstractSet: " + arr); // Check if AbstractSet is empty // using isEmpty() value System.out.println("Is AbstractSet empty? " + arr.isEmpty()); } } Output: AbstractSet: [1, 2, 3, 4] Is AbstractSet empty? false Example 2: Java // Java code to demonstrate the working of // isEmpty() method in AbstractSet import java.util.*; public class GFG { public static void main(String[] args) { // creating an AbstractSet AbstractSet<String> arr = new TreeSet<String>(); // print AbstractSet System.out.println("AbstractSet: " + arr); // Check if AbstractSet is empty // using isEmpty() value System.out.println("Is AbstractSet empty? " + arr.isEmpty()); } } Output: AbstractSet: [] Is AbstractSet empty? true Comment More infoAdvertise with us Next Article AbstractSet isEmpty() method in Java with Example C code_r Follow Improve Article Tags : Java Java-Collections Java - util package Java-Functions Java-AbstractSet +1 More Practice Tags : JavaJava-Collections Similar Reads AbstractMap isEmpty() Method in Java with Examples The AbstractMap.isEmpty() method of AbstractMap class is used to check for the emptiness of the map. The method returns True if no key-value pair or mapping is present in the map else False. Syntax: AbstractMap.isEmpty() Parameters: The method does not take any parameters. Return Value: The method r 2 min read AbstractSequentialList isEmpty() method in Java with Example The isEmpty() method of AbstractSequentialList in Java is used to check whether this AbstractSequentialList is empty or not. It returns an boolean value stating the same. Syntax: public boolean isEmpty() Parameters: This function has no parameters. Returns: The method returns an boolean value which 2 min read AbstractCollection isEmpty() Method in Java with Examples 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 T 2 min read ArrayList isEmpty() Method in Java with Examples In Java, the isEmpty() method of ArrayList is used to check if an ArrayList is empty.Example 1: Here, we use the isEmpty() method to check whether an ArrayList of integers is empty.Java// Java program to demonstrate the use of isEmpty() // method with ArrayList of Integers import java.util.ArrayList 2 min read Collection isEmpty() method in Java with Examples 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()Para 3 min read Like