关于list的问题 list的数据是通过map放进去的啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主结贴了。List<HashMap<Integer, String>> list = new ArrayList<HashMap<Integer, String>>(); HashMap<Integer, String> m1 = new HashMap<Integer, String>(); HashMap<Integer, String> m2 = new HashMap<Integer, String>(); m1.put(1, "-->m1:one"); m1.put(2, "-->m1:two"); m2.put(3, "-->m2:three"); m2.put(4, "-->m2:four"); list.add(m1); list.add(m2); for (int i = 0; i < list.size(); i++) { HashMap<Integer, String> m = new HashMap<Integer, String>(); m = list.get(i); Set<Entry<Integer, String>> set = m.entrySet(); Iterator<Entry<Integer, String>> it = set.iterator(); while (it.hasNext()) { Entry<Integer, String> e = it.next(); System.out.println(e.getKey() + e.getValue()); } }遍历出来了,自己琢磨吧 循环语句中的变量是什么意思 [求助]这个程序,有2个问题 帮忙总结一下Java中接口的作用? 关于Jasperreport的报表打印问题~ 在程序中如何保证只有一个connection呢? 在JAVA中用于解码HTML代码中& > '这样字符的类是什么? 请教Java的字符串编码转换 请教JDBC问题:[Microsoft][SQL Server JDBC Driver]Error Establishing socket 关于AWT的加载和显示图象的一个问题! 求bmp解码处理 请教一个内存回收问题 问环境配置问题.
楼主结贴了。
List<HashMap<Integer, String>> list = new ArrayList<HashMap<Integer, String>>();
HashMap<Integer, String> m1 = new HashMap<Integer, String>();
HashMap<Integer, String> m2 = new HashMap<Integer, String>();
m1.put(1, "-->m1:one");
m1.put(2, "-->m1:two");
m2.put(3, "-->m2:three");
m2.put(4, "-->m2:four");
list.add(m1);
list.add(m2); for (int i = 0; i < list.size(); i++) {
HashMap<Integer, String> m = new HashMap<Integer, String>();
m = list.get(i);
Set<Entry<Integer, String>> set = m.entrySet();
Iterator<Entry<Integer, String>> it = set.iterator();
while (it.hasNext()) {
Entry<Integer, String> e = it.next();
System.out.println(e.getKey() + e.getValue());
}
}
遍历出来了,自己琢磨吧