I have a mapping from an int[2] array to weights. So [2, 3] -> 5, [4,5] -> 6 etc. Is it a workable strategy to use a HashMap where I do h.put(Arrays.deepHashCode(a), w)? I have a large amount of data and I want to be able to quickly look up weights given coordinates x,y. I am seeing bugs where h.get(hashcode) seems to be returning me unexpected values later. Not always but occasionally. Is this possibly an artifact of the fact that [x,y] and [a, b] might occasionally have the same deepHashCode()? I will try to boil it down to a small piece of code but currently its hard to isolate this problem.
EDIT: I isolated the problem. Turns out Arrays.deepHashCode([2, 74]) is same as Arrays.deepHashCode([3, 43]) [both return 1097 on my system]. I incorrectly thought that the get() would resolve collisions for me.. but it can't since its mapping a hashcode to a value and the array key is no longer in existence when I did the put().
unexpected values? You seem to imply that you sometimes get the same hashCode for 2 different objects. Is that it? Because that's not disallowed.