如何将此内容转换为:
这样我就可以将它添加到ArrayList中,如下所示:
Map<String, Integer> itemsBought
这样我就可以将它添加到ArrayList中,如下所示:
public void add(String prd, int qty){
orderList.add(new Order(prd, qty));
}
除了这个解决方案,还有其他的解决方案吗:
hashMap.keySet().toArray();
hashMap.values().toArray();
Thank you in advance.
ArrayList
。话虽如此,我并没有看到这个答案有任何价值。 - mre