The get(k) method returns null if k is not in the symbol table. If k is in the symbol table, get(k) should return the value associated with k in the symbol table.
If null values were allowed and get(k) returned null, it would mean either
- k is not in the symbol table or
- k is in the symbol table and its associate value is null
It would be necessary to use the contains(k) method to distinguish these two cases.
In many cases, the get method would have to repeat all the same work in searching for the key k that the contains method does.
Requiring that values not be null means that if get(k) returns null, there is only one possibility: k is NOT in the symbol table.
Several Java API classes that implement symbol table methods allow null keys and null values while others do not.