【发布时间】:2021-04-18 07:30:57
【问题描述】:
我有以下类型的地图:
HashMap<String, Map<String, Integer>> resultMap = new HashMap<>();
在哪里String(Key) = Website address;
Map<String,Integer> = String(key) -search word, Integer(value) - counter for found words.
如何正确打印地图,使其看起来像这样:
- webSite1 - randomWord = 30,randomWord2 = 15,randomWord3 = 0
- webSite2 - randomWord = 9,randomWord2 = 8,randomWord3 = 1
提前感谢您的任何想法!
【问题讨论】:
-
到目前为止你尝试过什么?是什么导致了您的问题?
-
我不明白如何通过 foreach 从生成的 Map 中检索数据
标签: java arrays collections printing hashmap