public static void main(String[] args) {
Map<String, List<String>> input = new HashMap<String, List<String>>();
List<String> list = new ArrayList<String>();
list.add("《狂人日记》");
list.add("《狂人日记》");
list.add("《狂人日记》");
list.add("《狂人日记》");
input.put("小王", list);
Map<String, Map<String, Integer>> maplist = add(input);
System.out.println(maplist.get("小王").get("《狂人日记》"));
}
public static Map<String, Map<String, Integer>> add(
Map<String, List<String>> input) {
Map<String, List<String>> maplist = new HashMap<String, List<String>>();
Map<String, Integer> temp = new HashMap<String, Integer>();
temp.put("《狂人日记》", 0);
Map<String, String> map = new HashMap<String, String>();
map.put("小王
map中key值相等 对应value值加1
最新推荐文章于 2022-09-27 16:15:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)