集合嵌套的遍历思路

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32965187/article/details/83280757

集合嵌套:

怎么存?

Map存放Map
    HashMap1<键类型,值类型>
    HashMap2<键类型,值类型>
建一个Map存放前两个Map
    Map<键类型,HashMap>
    
怎么取?

找到总Map的所有的键(keySet方法)
遍历所有的键(iterator方法)
在遍历的过程中取得值(getValue),不过得到的值为Map集合,再根据Map集合的遍历方法取值

猜你喜欢

转载自blog.csdn.net/qq_32965187/article/details/83280757