I would like to print the matching value of key from multimap. So far I have been unsuccessful at it.
These are the line of code I got so far about it :
dictionaryGG.keys().forEach((key) -> {
if (userInput.equals(key)) {
System.out.println("User Input equal to KEY");
System.out.println("Value associated with matching KEY" + value); // get an error here "value cannot be resolved to a variable"
}
System.out.println(key);
}); ```
(dictionaryGG is my multimap)
Please read the Guava Wiki page on
Multimap:That said, you can fetch values mapped to a multimap key by simply using
Multimap#get(K):Please note that if you don't expect to have multiple values per key, a simple
Map&Map#get(Object)is sufficient.