码迷,mamicode.com
首页 >  
搜索关键字:获取集合元素的两种方式    ( 1个结果
List集合中两种遍历方式
遍历List集合中的元素的方法有两种: 第一种:利用迭代器遍历 代码1: // 迭代器 Iterator it=list.iterator(); while(it.hasNext()) { System.out.println(it.next()); }或者代码2: for(Iterator it=list.iterator();it.hasNext();) { System.o...
分类:其他好文   时间:2014-06-08 15:22:50    阅读次数:189
1条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!