Questions tagged [hashcode]

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

2025 questions
0
votes
2 answers

Merge two lists by key of first list

My main problem description goes like this: I have two lists of BankAccount objects. A BankAccount has properties such as BankCode and AccountNumber which uniquely identifies an account. So both the lists may contain the same bank account but they…
deostroll
  • 11,661
  • 21
  • 90
  • 161
0
votes
1 answer

Merge of String hashes into master hash

Should a merge of hashes of two String objects be the same as a hash of their concatenation? I was using XOR ^ operator (as advised here) and got a different result. What I am doing wrong? String a = "A"; String b = "B"; String ab = a+b; int i =…
max3d
  • 1,437
  • 15
  • 16
0
votes
1 answer

Hadoop's default partitioner: HashPartitioner - How it calculates hash-code of a key?

I am trying to understand partitioning in MapReduce and I came to know that Hadoop has a default partitioner known as HashPartitioner, and partitioner helps in deciding to which reducer a given key would go to. Conceptually, it works like…
CuriousMind
  • 8,301
  • 22
  • 65
  • 134
0
votes
2 answers

Hashmap have same inputs and equals and hashcode method implemented, but i am not getting error as duplicate key?

I have a very basic sample code to implement equals and hashcode. There is one map in which object of Employee class is used as key. I have debugged the code, and equals method returning true for duplicate object. All the values are same for emp…
0
votes
2 answers

JavaFX: How do I override the hashCode method for a bean with properties?

It is common knowledge that when equals() is overridden, hashCode() must also be overridden. This is a typical example of this in a non-JavaFX bean class. public class Person { private String name; private int age; @Override public…
Jai
  • 8,165
  • 2
  • 21
  • 52
0
votes
1 answer

When does string caches it's hashcode ? Is it during the String object creation time or Once the hashcode method get called?

When does string caches it's hashcode? I found a lot of article saying, string caches it's hashcode during when we create a string literal. if this is true, then when we create a string object, why it's "hash" is showing 0? I think Once after the…
0
votes
1 answer

Is it mandatory to include collection type fields like Hashset in hashCode() and equal() methods

In my project I have seen the performance issues if we include collection fields in hashCode() and equal() methods.Is it mandatory to include or not? Below is the sample program. Student.java public class Student { int no; String name; …
user3094331
  • 532
  • 6
  • 21
0
votes
0 answers

Inserting dictionary word into Hash table

I am doing a project for inserting dictionary word into hash table. If collision occurred, hash the new word into same position to the next. I created an array of pointers: typedef struct WordNode * WordNodeP; typedef struct WordNode { char…
Yizhi Hu
  • 57
  • 8
0
votes
4 answers

How is the hashcode of std::unordered_map calculated?

The unordered map of the C++ standard std::unordered_map is a hashtable data structure, which means it has a constant access time complexity O(1). But how is the hashcode calculated to give a unique key index to access a member of the table…
Pierre Nicolas
  • 65
  • 2
  • 10
0
votes
0 answers

HashMap entry has been lost

I don't understand why this code: import java.util.HashMap; import java.util.Map; import java.util.Objects; public class Main { public static void main(String[] args) { Map map = new HashMap<>(); Person person =…
k13i
  • 4,011
  • 3
  • 35
  • 63
0
votes
1 answer

In SSL CERTIFICATE two fingerprint SHA-256 & SHA-1

In google SSL certificate, why two fingerprint are present. According to my understanding there should be only one fingerprint. Fingerprint: Terms checksum, hash sum, hash value, fingerprint, thumbprint are used to describe the digital output…
Kandan Siva
  • 471
  • 2
  • 9
  • 20
0
votes
0 answers

hashCode and equals for JPA Entity

I need some thoughts on this implementation of hashCode and equals for Hibernate entities. The main goal is to identify two same objects representing row in db and distinguish them from unsaved objects and remove or add items to relations…
Mihael Mamula
  • 330
  • 3
  • 11
0
votes
1 answer

Hibernate showing non unique object exception during bulk insert of parent entity with Cascade All. Tried all possibilities

I understand that this question has been asked a lot of times on this forum but i believe sometimes there are new kind of issues coming up. This one might be a type. So i have this code with a parent child entity. The relationship between parent to…
CVS
  • 41
  • 6
0
votes
2 answers

JavaScript equivalent to Guava's HashCode?

In Java, I get a hashCode using Google Guava: HashFunction hashFunction = Hashing.md5(); Hasher hasher = hashFunction.newHasher(); hasher.putLong(arg); HashCode hashCode = hasher.hash(); long asLong = hashCode.asLong(); Is there an equivalent to…
junxi
  • 165
  • 7
0
votes
2 answers

Sending a verification code Link in email

I'm new in programming. How am I going to send A verification link in email? I managed to send Email but not A verification code, that a user must click in order to complete the registration. thanks in advance. Here is the code in sending…
Kuya
  • 28
  • 11