集合嵌套
所谓集合嵌套简单说来就是指集合中存储的元素还是集合,下面用例子说明集合嵌套的实现和遍历
如要存储以下信息:
品牌1:apple
iphone12 价格 6300
MacBook Pro 价格 20599
品牌2 :xiaomi
mi11Ultra 价格 5999
RedmiBook Pro 价格 6299
使用HashMap为例进行集合嵌套的演示
static void mapqiantao() {
//申请两个集合
HashMap <String,Integer> apple = new HashMap<String,Integer>();
HashMap <String,Integer> xiaomi = new HashMap<String,Integer>(