hash-code-uniqueness Questions

6

Solved

I'm overriding the equals and hashcode methods for a simple container object for two ints. Each int reflects the index of another object (it doesn't matter what that object is). The point of the cl...
Mcquade asked 8/4, 2013 at 11:30

5

Solved

I have a HashMap with coordinates as keys. Coordinates have 3 longs holding the x, y and z coordinate. (Coordinate is and needs to be a custom class, the coordinates need to be longs). Now i want...
Revisory asked 20/4, 2011 at 12:21

8

Solved

I have a simple custom Point class as follows and I would like to know if my hashCode implemention could be improved or if this is the best it's going to get. public class Point { private final ...
Gabelle asked 3/2, 2012 at 21:30

6

Solved

I want to know the probability of getting duplicate values when calling the GetHashCode() method on string instances. For instance, according to this blog post, blair and brainlessness have the sam...
Dasie asked 1/11, 2011 at 15:26

2

Solved

I tried to write a small program to demonstrate hash collisions in java when only equals is overridden and not hashcode() method. This was to prove the theory that two unequal objects can have the ...

1

Solved

I have sorted lists of filenames concatenated to strings and want to identify each such string by a unique checksum. The size of these strings is a minimum of 100 bytes, a maximum of 4000 bytes, a...
Varicelloid asked 14/4, 2016 at 19:9

2

Solved

Like many of you, I use ReSharper to speed up the development process. When you use it to override the equality members of a class, the code-gen it produces for GetHashCode() looks like: public ov...
Desiderative asked 19/9, 2008 at 15:20

5

Solved

I'm hashing a large number of files, and to avoid hash collisions, I'm also storing a file's original size - that way, even if there's a hash collision, it's extremely unlikely that the file sizes ...
Dromedary asked 14/3, 2010 at 15:31

5

Solved

I know when we are passing objects we are passing its reference as a value. But this value you get is using the hashcode() method right (according to my tests it's the same)? Since hashcode() is no...
Cristalcristate asked 16/6, 2012 at 4:6

3

Solved

Though two different objects may have the same hash code, however, System.identityHashCode() seems return the memory pointer of the object. I guess there could be no exception in 32-bit JVM impleme...
Tellurion asked 18/5, 2012 at 1:7

3

Solved

I had the following code to generate a hash of an object: public int GetHashCode(MyType obj) { return (obj.Prop1.GetHashCode() + obj.Prop2.GetHashCode() + obj.Prop3.GetHashCode()).GetHashCode(); ...
Roseleeroselia asked 8/6, 2011 at 21:57

5

If I'm hashing size-constrained similar data (social security numbers, for example) using a hash algorithm with a larger byte size than the data (sha-256, for example), will the hash guarantee the ...
Nava asked 19/2, 2010 at 21:50

1

Solved

I have a pretty complex object and I need to get uniqueness of these objects. One solution can be done by overriding GetHashCode(). I have implemented a code noted below: public override int GetHa...
Keil asked 14/1, 2010 at 6:38

4

Solved

I have a system that requires a unique 6-digit code to represent an object, and I'm trying to think of a good algorithm for generating them. Here are the pre-reqs: I'm using a base-20 system (no ...

2

Solved

So I'm reading up about hash tables, hash functions etc. I was intrigued to read on wikipedia about how "dynamic perfect hashing" involves using a second hash table as the data structure to store m...
1

© 2022 - 2024 — McMap. All rights reserved.