list的四种遍历方法
2017-09-27 10:03:18    262    0    0
gaara
   //方法1
        Iterator it1 = list.iterator();
        while(it1.hasNext()){
            System.out.println(it1.next());
        }
        //方法2
        for(Iterator it2 = list.iterator();it2.hasNext();){
             System.out.println(it2.next());
        }
        //方法3
        for(String tmp:list){
            System.out.println(tmp);
        }
        //方法4
        for(int i = 0;i < list.size(); i ++){
            System.out.println(list.get(i));
        }​


Pre: MANIFEST.MF的写法

Next: Struts漏洞

262
Sign in to leave a comment.
No Leanote account? Sign up now.
0 comments
Table of content