Can't you just create your own key class that implements equals and hashcode accordingly?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
If you are certain that no key of type 1 could ever match a key of type 2 you could just put each object in the map twice, once with each key. This might work with state and zipcode where AK could not be a zipcode and 10010 could not be a state.
states.put( stateCode, state) states.put( zipCode, state) state = states.get( "AK" ) state = states.get( "10010" )
Any key collision would be fatally confusing, I'd expect.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad: