Aeal:
-> Insert doesn't work, if there's already a key
-> Set doesn't work, if there isn't a key
Checking if they exist was avoided for better performance. I really advise you to know which values you already have, and which not.
But if you can't control knowledge about values you have: you can do work with the Function Object.
<img src="http://www.tymczasownik.republika.pl/hashtable.png">