"hash % capacity" looks trivial until you trace it by hand. Two separate bugs hide in that one line — and the fix for one of them has its own hole. Building a HashMap from scratch, the "turn a key into a bucket index" line looks like it should be the easy part: int bucket = key.hashCode() % capacity; I traced this by hand before writing a single... Weiterlesen
Intelligence View
The hashCode()-to-Array-Index Bug Almost Everyone Writes Once
"hash % capacity" looks trivial until you trace it by hand. Two separate bugs hide in that one line — and the fix for one of them has its own hole. Building a HashMap from scratch, the "turn a key into a bucket index" l…
SOCIAL SHARE CARD GENERATOR