java.util.IdentityHashMap.hashCode() Method


Advertisements


Description

The hashCode() method is used to get the hash code value for this map.

Declaration

Following is the declaration for java.util.IdentityHashMap.hashCode() method.

public int hashCode()

Parameters

  • NA

Return Value

The method call returns the hash code value for this map.

Exception

  • NA

Example

The following example shows the usage of java.util.IdentityHashMap.hashCode()

package com.tutorialspoint;

import java.util.*;

public class IdentityHashMapDemo {
   public static void main(String args[]) {
   // create identity hash map
   IdentityHashMap ihmap = new IdentityHashMap();
           
   // populate the map
   ihmap.put(1, "java");
   ihmap.put(2, "util");
   ihmap.put(3, "package");
     
   System.out.println("Hash code value is: " + ihmap.hashCode());
   }    
}

Let us compile and run the above program, this will produce the following result.

Hash code value is: 12336129

java_util_identityhashmap.htm

Advertisements