Yes, the requirements say to throw a duplicatekeyexception if there's an attempt to generate a duplicate key.
But as the requirements don't specify a key, there's no way (unless you, like you did, specify your own) to ever generate a duplicate key as there's no key at all
All depends on how you explain the requirements I guess, just make sure you (as always) document your decisions.