From 5bc96cf78955dc9c2c89a1e39ccbbb15a6b04e08 Mon Sep 17 00:00:00 2001 From: Piotr Idzik <65706193+vil02@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:47:35 +0200 Subject: [PATCH] style: include `RV_ABSOLUTE_VALUE_OF_HASHCODE` (#5273) --- spotbugs-exclude.xml | 3 --- .../hashmap/hashing/GenericHashMapUsingArray.java | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index f1b48d528..8648b9109 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -89,9 +89,6 @@ - - - diff --git a/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java b/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java index 9fbb2ff0a..416cee99d 100644 --- a/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java +++ b/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java @@ -47,8 +47,7 @@ public class GenericHashMapUsingArray { // tells which bucket to go to private int hashFunction(K key) { - int hc = key.hashCode(); - return Math.abs(hc) % buckets.length; + return Math.floorMod(key.hashCode(), buckets.length); } private void reHash() {