Search by name you already have from the map itself. For the others you have to loop through all the Employee values in the map testing each Employee to see if it has the desired values.
JamesCherrill
... trying to help
8,668 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,479
Skill Endorsements: 33
Are you asking how to find a record using any one of several keys: name, id, email address?
If you must use HashMaps, and all the keys are unique, then you could store references to the same record as the value using the different keys.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
HashMaps work best when the keys are not subject to change - so id is presumably fixed, and is ideal, name is mostly fixed (except when some women get married), email address is less ideal (subject to more change). The problem when you update an Employee with (say) a new email address is that you need to know that email address is used as a key in some HashMap somewhere, and you have to update the HashMap as well.
For the fields that don't change, bulding a HashMap gives you a very quick and easy search mechanism, but for fields that do change it's safer to do an explicit search.
JamesCherrill
... trying to help
8,668 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,479
Skill Endorsements: 33