PROPOSAL: Enhanced for each loop iteration control

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

As you can see i was thinking about it for while:

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.


ArrayList<String> some ....;
i: for (Strign s:some){
    if (  (s==null) || (s.equals("bad")) )) i.remove();
    ...; // 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){

Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

More information about the coin-dev mailing list