PROPOSAL: Enhanced for each loop iteration control

Marek Kozieł develop4lasu at gmail.com
Mon Mar 30 01:17:26 PDT 2009


As you can see i was thinking about it for while:
http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001105.html

And i found few problems.
New iterator Interface is wrong path, because people will be not able
to use it with their iterators.


So from your proposal I would remove Interface-s and link iterator
through label,
label type is return type of .iterator() method.


like:

ArrayList<String> some ....;
...
i: for (Strign s:some){
    if (  (s==null) || (s.equals("bad")) )) i.remove();
    ...
    i.next(); // compile time error ?
    i.hasNext(); // OK
    Iterator<String> s = i; // error i is not variable (it just allow
to access it;)
}

String[] array ...;
i: for (String s:array){
    i.getIndex;//?
}



-- 
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list