Skip to content

Commit 6f1475b

Browse files
committed
Custom HashMap
Signed-off-by: https://github.com/Someshdiwan <someshdiwan369@gmail.com>
1 parent 850981a commit 6f1475b

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
extended version of the custom HashMap that includes:
2+
3+
- Iteration: Implements the Iterable interface so you can loop over all entries.
4+
- Dynamic Size Tracking: A method (`size()`) returns the current number of key-value pairs.
5+
- Load Factor Tuning: A configurable load factor (with getters and setters) and a constructor that accepts an initial
6+
capacity and load factor.
7+
8+
Extended Custom HashMap Implementation
9+
10+
Explanation of Extensions:
11+
- Iteration:
12+
13+
- The class now implements Iterable<Entry<K, V>> and provides an inner HashMapIterator that traverses each non-empty bucket
14+
15+
- You can use a for-each loop to iterate over all key-value pairs.
16+
17+
- Dynamic Size Tracking:
18+
- The size field is updated on every put() and remove() call.
19+
- The size() method returns the current count of entries.
20+
21+
- Load Factor Tuning:
22+
- The loadFactor field is configurable through constructors and the setLoadFactor() method.
23+
- The resize() method uses this load factor to determine when to double the bucket array.

0 commit comments

Comments
 (0)