isEmpty(): This method is available in java.util.IdentityHashMap class of Java.
Syntax:
boolean java.util.IdentityHashMap.isEmpty()
This method returns true if this identity hash map contains no key-value mappings.
Parameters: NA
Returns: true if this identity hash map contains no key-value mappings.
Exceptions: NA
Approach
Java
import java.util.IdentityHashMap;public class IdentityHashMapisEmpty {public static void main(String args[]) {IdentityHashMap<String, Integer> identityHashMap =new IdentityHashMap<String, Integer>();identityHashMap.put("Java", 1);identityHashMap.put("Hello", 2);System.out.println(identityHashMap.isEmpty());}}
Output:
false
No comments:
Post a Comment