Clairvoyant interview question

How to use custom key for HashMap? What precaution should be taken for same?