I've got a basic HashMap. I'm trying to loop over it and get both the key and the value out of the Map. Here's what I have:
Map<String, String> myMap = versionExtractor.getVersionInfo();
for(String key : myMap.keySet())
System.out.println(key);
System.out.println(myMap.get(key));
}
The problem is that this won't compile. There is an error on the line that says System.out.println(myMap.get(key)); that says:
java: class, interface, or enum expected
And the intelliJ IDE says: Cannot resolve symbol 'key'. The perplexing thing is that is resolved key without a problem in the preceding line that says System.out.println(key);. What's up with that?
{? lol... oh geez.