I finished the Part 1 of the course, by using C# (with a Unit Test Project in the same solution), I think there’s a bug method GetOrCreateBucket(key), in HashTable video Solution - Refactoring…
In case the bucket is null, it will create a new LinkedList in the entries[index] but wont initialize in the “bucket” variable that will be return, what can cause a null reference exception, that I caught in the Unit Testing. So in my case I solved by
if (bucket == null)
bucket = _entries[index] = new LinkedList();return bucket;
or more concise:
var bucket = _entries[index] ?? (_entries[index] = new LinkedList());
return bucket;