java 迭代器的使用

复制代码

1 List list = new ArrayList();
2 list.add(“a”);
3 list.add(“b”);
4 Iterator iterator = list.iterator();
5 while(iterator.hasNext()){
6 String next = iterator.next();
7 System.out.println(next);
8 }

猜你喜欢

转载自blog.csdn.net/HEshenghuxi/article/details/84787586