Skip to content

Commit f3ead5f

Browse files
williamfisetclaude
andcommitted
Refactor HashTableSeparateChaining: encapsulate Entry, fix iterator, simplify API
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 69b49f7 commit f3ead5f

2 files changed

Lines changed: 149 additions & 166 deletions

File tree

0 commit comments

Comments
 (0)