mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 10:15:51 +08:00
style: include RV_ABSOLUTE_VALUE_OF_HASHCODE
(#5273)
This commit is contained in:
@ -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