IdentityHashMap isEmpty Example

IdentityHashMap class isEmpty example. This example shows you how to use isEmpty method.


IdentityHashMap class isEmpty example. public boolean isEmpty() Returns true if this identity hash map contains no key-value mappings.

Here is the code

/**
 * @ # EntrySet.java
 * A class repersenting use to entrySet method 
 * of IdentityHashMap class in java.util package
 * version 26 May 2008
 * author Rose India 
 */
import java.util.*;

public class IsEmpty {

    public static void main(String args[]) {
        IdentityHashMap map = new IdentityHashMap();
        System.out.println("Map is Empty " + map.isEmpty());
        //Add the mapping into the map 
        map.put(1"A");
        map.put(2"A");
        map.put(3"B");

        System.out.println("Map is Empty " + map.isEmpty());
    }
}

Output
Map is Empty true
Map is Empty false

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US