From 15b36a6c21fe069c232ae58be5c174b337b2611d Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 2 Nov 2016 13:27:21 +1300 Subject: Bug 1338 - IndexRow of GeometryInfo returns a terrible constant hash --- .../org/jogamp/java3d/utils/geometry/GeometryInfo.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java b/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java index 4bff8e9..3ee14bb 100644 --- a/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java +++ b/src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java @@ -42,6 +42,7 @@ package org.jogamp.java3d.utils.geometry; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; +import java.util.Arrays; import java.util.HashMap; import org.jogamp.java3d.GeometryArray; @@ -1564,25 +1565,18 @@ public class GeometryInfo { private class IndexRow { int[] val; int size; - private static final int HASHCONST = 0xBABEFACE; + //private static final int HASHCONST = 0xBABEFACE; @Override public int hashCode() { - int bits = 0; - for (int i = 0 ; i < size ; i++) { - bits ^= (bits * HASHCONST) << 2; - } - return bits; + return Arrays.hashCode(val); } // End of IndexRow.hashCode @Override public boolean equals(Object obj) { - for (int i = 0 ; i < size ; i++) { - if (((IndexRow)obj).get(i) != val[i]) return false; - } - return true; + return Arrays.equals(val, ((IndexRow) obj).val); } // End of IndexRow.equals() public int get(int index) -- cgit v1.2.3