Hello,
Your iterator is not good, we must iterate through the collection of pairs (key + value) - so the type Map.Entry <Article, string> - and not on collection of keys only. The function that okay? HashMap: entrySet ():
Code:
<Article,String> HashMap itms = new HashMap <Article,String>();
/ / Add to your articles.
Iterator <Map.Entry<Article, String>> it = itms.entrySet().iterator()
while (it.hasNext()) {
Map.Entry<Article, Integer> entry = it.next();
Article = entry.getKey();
String s = entry.getValue();
System.out.System.out.println("map ["+ a +"] = "+ s);
}
Bookmarks