Top "Hashcode" questions

A hash code is a result of applying a hash function to data, usually resulting in an integer.

Hashcode and Equals for Hashset

Please clarify my doubt in Hashset. Consider the following code, class Person { String name; Person(String n) { name=n; } public …

java equals hashcode hashset
Understanding the workings of equals and hashCode in a HashMap

I have this test code: import java.util.*; class MapEQ { public static void main(String[] args) { Map<ToDos, String&…

java hashmap equals hashcode
HashMap with Null Key and Null Value

Consider the following Code : import java.util.*; class Employee { String name; public Employee(String nm) { this.name=nm; } } public class …

java collections null hashmap hashcode
How is hashCode() calculated in Java

What value does the hashCode() method return in java? I read that it is a memory reference of an object... …

java hashcode
Apache Commons equals/hashCode builder

I'm curious to know, what people here think about using org.apache.commons.lang.builder EqualsBuilder/HashCodeBuilder for implementing the …

java hibernate equals apache-commons hashcode
Bad idea to use String key in HashMap?

I understand that the String class' hashCode() method is not guarantied to generate unique hash codes for distinct String-s. I …

java string map hashcode
What's a correct and good way to implement __hash__()?

What's a correct and good way to implement __hash__()? I am talking about the function that returns a hashcode that …

python hashtable hashcode dictionary
How does Java order items in a HashMap or a HashTable?

I was wondering how Java orders items in the Map (HashMap or Hashtable) when they are added. Are the keys …

java map hashtable hashmap hashcode
How default .equals and .hashCode will work for my classes?

Say I have my own class public class MyObj { /* ... */ } It has some attributes and methods. It DOES NOT implement equals, …

java object equals hashcode equality
Why use a prime number in hashCode?

I was just wondering why is that primes are used in a class's hashCode() method? For example, when using Eclipse …

java hashcode primes