Collection Interface hashCode() Method

Collection Interface hashCode() Method


Posted in : Java Posted on : November 27, 2010 at 11:08 AM Comments : [ 0 ]

Using this method we can find out the hash code for the invoking collection.

Collection Interface hashCode() Method:

Using this method we can find out the hash code for the invoking collection.

Syntax :

int hashCode();

Example :

import java.util.ArrayList;
import java.util.List;

public class CollectionInterfaceHashCodeMethod {

public static void main(String[] args) {
List arraylist = new ArrayList();

arraylist.add("Deepak");
arraylist.add("Kumar");

int hashcode = arraylist.hashCode();
System.out.println("hashcode = " + hashcode);
}
}

Output :

hashcode = -1013147681

Download This example code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics