I have this method here that gets an object from a JList. The object would then be a string that matches certain values in a hashmap. There are multiple values, for example.
Course1 - John
Course2 - John
Course3 - Mary
Course4 - Mary
are there any ways to loop through a hashmap and look for certain value, then place both key & value into a string that can then be added to a list model?
If you are searching for values only, use the keySet() method of the hashmap to get the keys and then loop through them to get the corresponding values.
If you are searching for both keys and values, use the entrySet() method of the hashmap to get the entries and then loop through them to look for the match.