Skip to content

Commit 5bc96cf

Browse files
authored
style: include RV_ABSOLUTE_VALUE_OF_HASHCODE (#5273)
1 parent e63c39a commit 5bc96cf

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

spotbugs-exclude.xml

-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@
8989
<Match>
9090
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
9191
</Match>
92-
<Match>
93-
<Bug pattern="RV_ABSOLUTE_VALUE_OF_HASHCODE" />
94-
</Match>
9592
<!-- fb-contrib -->
9693
<Match>
9794
<Bug pattern="OCP_OVERLY_CONCRETE_PARAMETER" />

src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArray.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public void put(K key, V value) {
4747

4848
// tells which bucket to go to
4949
private int hashFunction(K key) {
50-
int hc = key.hashCode();
51-
return Math.abs(hc) % buckets.length;
50+
return Math.floorMod(key.hashCode(), buckets.length);
5251
}
5352

5453
private void reHash() {

0 commit comments

Comments
 (0)