Skip to content

Commit 00b0301

Browse files
committed
Fix
1 parent b8a5023 commit 00b0301

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class GenericHashMapUsingArray<K, V> {
2727

2828
private int size; // Total number of key-value pairs
2929
private LinkedList<Node>[] buckets; // Array of linked lists (buckets) for storing entries
30-
private final float loadFactorThreshold = 0.75f; // Load factor threshold for resizing
3130

3231
/**
3332
* Constructs a new empty hash map with an initial capacity of 16.
@@ -72,6 +71,8 @@ public void put(K key, V value) {
7271
size++;
7372

7473
// Check if rehashing is needed
74+
// Load factor threshold for resizing
75+
float loadFactorThreshold = 0.75f;
7576
if ((float) size / buckets.length > loadFactorThreshold) {
7677
reHash();
7778
}

0 commit comments

Comments
 (0)