我正在使用Java编程,并声明了以下两个map:
private Map<MyCustomClass, Integer> map1, map2;
map1 = new HashMap<MyCustomClass, Integer>();
map2 = new HashMap<MyCustomClass, Integer>();
//adding some key value pair into map1
//adding some key value pair into map2
private ArrayList<MyCustomClass> list = new ArrayList<MyCustomClass>();
现在我希望在上面声明的
ArrayList
中插入两个映射的键。是否存在内置方法可以实现这一点,还是需要编写一些自定义代码?