CompositeName isEmpty() method in Java with Examples Last Updated : 27 Mar, 2020 Comments Improve Suggest changes Like Article Like Report The isEmpty() method of a javax.naming.CompositeName class is used to check this composite name object is empty or not. A composite name is said to be empty if it has zero components. Syntax: public boolean isEmpty() Parameters: This method accepts nothing. Return value: This method returns true if this composite name is empty, false otherwise. Below programs illustrate the CompositeName.isEmpty() method: Program 1: Java // Java program to demonstrate // CompositeName.isEmpty() import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException; public class GFG { public static void main(String[] args) throws InvalidNameException { // create composite name object CompositeName CompositeName1 = new CompositeName("a/b/z/y/x"); // apply isEmpty() boolean isEmpty = CompositeName1.isEmpty(); // print value System.out.println( "This composite " + "object is empty: " + isEmpty); } } Output: This composite object is empty: false Program 2: Java // Java program to demonstrate // CompositeName.isEmpty() method import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException; public class GFG { public static void main(String[] args) throws InvalidNameException { // create composite name object CompositeName CompositeName1 = new CompositeName(""); // apply isEmpty() boolean isEmpty = CompositeName1.isEmpty(); // print value System.out.println( "This composite " + "object is empty: " + isEmpty); } } Output: This composite object is empty: true References: https://docs.oracle.com/javase/10/docs/api/javax/naming/CompositeName.html#isEmpty() Comment More infoAdvertise with us Next Article CompositeName isEmpty() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Practice Tags : Java Similar Reads CompoundName isEmpty() method in Java with Examples The isEmpty() method of a javax.naming.CompoundName class is used to check this compound name object is empty or not. A compound name is said to be empty if it has zero components. Syntax: public boolean isEmpty() Parameters: This method accepts nothing. Return value: This method returns true if thi 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 CompositeName equals() method in Java with Examples The equals() method of a javax.naming.CompositeName class is used to compare this CompositeName with the specified object passed as a parameter and checks whether two objects are equal or not. If both objects are equal then the equals() method returns true else false. If passed obj is null or not a 2 min read 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 CompositeName endsWith() method in Java with Examples The endsWith() method of a javax.naming.CompositeName class is used to check whether composite name which is passed as a parameter is a suffix of this composite name or not. A composite name 'X' is a suffix of this composite name if this composite name object ends with 'X'. If X is null or not a com 2 min read Like