For loop in the form of : “for (A b : c)” in Java

前端 未结 7 907
耶瑟儿~
耶瑟儿~ 2021-01-13 12:32

This is the first time that I\'ve seen this kind of syntax :

// class Node
public class Node { 

...
...

}

public class Otherclass { ... }

Otherclass gra         


        
7条回答
  •  太阳男子
    2021-01-13 13:26

    This is one representation of your for loop

    for(int i=0;i

    This is not a for loop but still you could do this.

    Iterator itr = successors.iterator();
    
        while(itr.hasNext()){
            Node myNode = itr.next();
            // your logic
        }
    

提交回复
热议问题