Commit a236008
Refactor HashTableSeparateChaining: encapsulate Entry, fix iterator, simplify API (#1316)
Make Entry a private static inner class. Remove redundant method aliases
(add/insert/hasKey) in favor of put/containsKey. Add dedicated modCount
for fail-fast iteration instead of using size as a proxy. Rewrite iterator
so hasNext() is idempotent. Use single-pass iterator removal in removeEntry
to avoid double linear scan. Remove unnecessary bucket.clear() in resize.
Add educational comments on key implementation details.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent bc6dfd6 commit a236008
File tree
2 files changed
+149
-166
lines changed- src
- main/java/com/williamfiset/algorithms/datastructures/hashtable
- test/java/com/williamfiset/algorithms/datastructures/hashtable
2 files changed
+149
-166
lines changed
0 commit comments