I am trying to understand how a Map from the Java Collections Framework works. I understand that it maps values to a key, but what if I want to create an employee who has a first name, last name, gender, and an ID (which I would use as the key).
So I tried this code…
Map <Employee> employeeMap = new HashMap<String,String,String,String,int>();
But it doesn’t like this, as it wants only two parameters to be entered. So, how do I add an entire employee to the Map which contains more then two values?
you have an Employee class, don’t you?
when you have an object of Employee, say “
em”then you can