File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Oracle/OAS and the fly likes hashCode method implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "hashCode method implementation" Watch "hashCode method implementation" New topic
Author

hashCode method implementation

wrushasen dakhane
Ranch Hand

Joined: Sep 25, 2006
Posts: 47
Consider we have

Employee e1 = new Employee("TCS");
Employee e2 = new Employee("GS");
Employee e3 = new Employee("TCS");

where Employee is our class.

How should we implement the hashCode method so that we can have same hasCode value for objects e1 and e3.
Best Regards,
Wrushasen D.


SCJP 1.4, SCWCD 1.4
rajesh ssh
Greenhorn

Joined: Aug 23, 2006
Posts: 11
implementation of hashCode for above scenario is difficult as for my concern,is because Employee class not having variables to distinguish with parameterised constructor's parameter...
ofcourse return type of hashcode is int so how the int value relates to string and with that one it is different for different values.
so,if anybody can tell please...


Regards<br />RAJESH.M
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

I have posted the reply in the other post of yours in the Java(beginner) forum
Here is the link
Please dont post the same question in multiple forums.


apigee, a better way to API!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hashCode method implementation
 
Similar Threads
garbage collection
hashCode() - why?
Custom keys in tree map
How to implement hashCode()
hashCode method implementation