如何从包含键字符串和列表的hashmap中只获取一个值HashMap<String, ArrayList<Person>> person = new HashMap<String,ArrayList<Person>>();Person(int phone, String mail){
this.phone = p
我有一个方法,它允许我通过获取AirbnbListing对象来从ArrayList创建HashMap,然后将邻居名称与HashMap中的任何键进行比较。如果它不在hashmap中,我会用一个从1开始的计数器来添加它,如果它已经存在,我会递增计数器。下面是我的代码,有没有更有效的方法来做到这一点:
public HashMap<String, Integer</