implemented my hashmap#1684
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on your MyHashMap implementation! All the core requirements are met, and the code is clean and well-structured. I am approving this solution.
For future reference, it's a good practice to avoid using 'magic numbers'. In your resizeIfNeeded method, the value 2 used for resizing could be defined as a named constant, like private static final int RESIZE_MULTIPLIER = 2;. This makes the code more readable and easier to maintain, which aligns with checklist item #2.
Overall, this is a very strong submission. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| return; | ||
| } | ||
| Node<K, V>[] oldTable = table; | ||
| table = new Node[oldTable.length * 2]; |
There was a problem hiding this comment.
The value 2 used as the resizing multiplier is a magic number. It's better practice to declare it as a named constant (e.g., RESIZE_MULTIPLIER) at the top of the class to improve readability and make it easier to change in the future. This addresses checklist item #2.
No description provided.