I have a hashmap that contains, person Id as key, and person object as value.
Map<String, Person> personMap = new HashMap<String,Person>();
The person object (map's value) contains a person Id instance variable that I'd like to compare with user input. My idea is to create an arraylist from the map's values as mentioned here - How to convert a Map to List in Java?, so I can check if the arraylist.contains(userInput).
However, I need a arraylist of strings that contains Person.getPersonId(),please help me here. Can I do it in one step? If there is a better alternative then, please suggest.