Skip to content

Commit 2a99969

Browse files
authored
fix: use murmur3_32_fixed() in place of murmur3_32() (#118)
1 parent 9930431 commit 2a99969

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/main/java/org/danilopianini/util/FlexibleQuadTree.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
*******************************************************************************/
77
package org.danilopianini.util;
88

9-
import static java.lang.Math.ceil;
10-
import static java.lang.Math.floor;
11-
import static java.lang.Math.max;
12-
import static java.lang.Math.min;
13-
import static java.lang.Math.nextDown;
14-
import static java.lang.Math.nextUp;
9+
import com.google.common.base.Optional;
10+
import com.google.common.hash.Hashing;
1511

12+
import javax.annotation.Nonnull;
1613
import java.io.Serializable;
1714
import java.util.ArrayList;
1815
import java.util.Collections;
@@ -22,10 +19,12 @@
2219
import java.util.List;
2320
import java.util.Objects;
2421

25-
import javax.annotation.Nonnull;
26-
import com.google.common.base.Optional;
27-
import com.google.common.hash.Hasher;
28-
import com.google.common.hash.Hashing;
22+
import static java.lang.Math.ceil;
23+
import static java.lang.Math.floor;
24+
import static java.lang.Math.max;
25+
import static java.lang.Math.min;
26+
import static java.lang.Math.nextDown;
27+
import static java.lang.Math.nextUp;
2928

3029
/**
3130
*
@@ -539,12 +538,14 @@ public boolean equals(final Object obj) {
539538
}
540539

541540
@Override
541+
@SuppressWarnings("UnstableApiUsage")
542542
public int hashCode() {
543-
final Hasher hasher = Hashing.murmur3_32().newHasher();
544-
hasher.putDouble(x);
545-
hasher.putDouble(y);
546-
hasher.putInt(element.hashCode());
547-
return hasher.hash().asInt();
543+
return Hashing.murmur3_32_fixed().newHasher()
544+
.putDouble(x)
545+
.putDouble(y)
546+
.putInt(element.hashCode())
547+
.hash()
548+
.asInt();
548549
}
549550

550551
public boolean isIn(final double sx, final double sy, final double fx, final double fy) {

0 commit comments

Comments
 (0)