mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
style: include RV_ABSOLUTE_VALUE_OF_HASHCODE (#5273)
This commit is contained in:
@@ -89,9 +89,6 @@
|
||||
<Match>
|
||||
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="RV_ABSOLUTE_VALUE_OF_HASHCODE" />
|
||||
</Match>
|
||||
<!-- fb-contrib -->
|
||||
<Match>
|
||||
<Bug pattern="OCP_OVERLY_CONCRETE_PARAMETER" />
|
||||
|
||||
@@ -47,8 +47,7 @@ public class GenericHashMapUsingArray<K, V> {
|
||||
|
||||
// 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() {
|
||||
|
||||
Reference in New Issue
Block a user