fork download
  1. import java.util.*;
  2. class Main {
  3. public static void main (String[] args) {
  4. List<Boolean> l = new ArrayList<Boolean>();
  5. l.add(true);
  6. l.add(true);
  7. l.add(null);
  8. l.add(true);
  9. int c = 0;
  10. for(Iterator<Boolean> it = l.iterator(); it.hasNext();) {
  11. Boolean b = it.next();
  12. if(b != null && b) {
  13. System.out.println(c);
  14. }
  15. c++;
  16. }
  17. }
  18. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
0
1
3