Hello,
I have a map (doesn't matter if it's hashmap or treemap or whaterer, just as long as it has keys and values).
I have several keys (of Person) in the map that have the same value (of Job).
public class Person
{
private String name;
public Person (String name) {
this.name = name;
}
@Override
public String toString() {
return this.name;
}
}
public class Job {
private String name;
public Job (String name) {
this.name = name;
}
@Override
public String toString() {
return this.name;
}
}
How can I retreive a list of keys which have the same value in the map ? Or In another words, how can I retreive a list of persons who all have the same Job ?
Is a map a good choice here at all ?
Many many thanks and best wishes,
desmond5