Some other candidates for Iterable:
Bug 6793773 - Let CharsetProvider implement Iterable <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6793773> Bug 6935695 - String should implement Iterable <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6935695>

-Ulf


Am 25.08.2011 10:19, schrieb mike.ske...@talk21.com:
Hi
I know this is slightly off topic but f there is a discussion on enhancing the 
for each loop ...

1 is there any chance that we could use ARM functionality and allow a 
ClosableIterator to be introduced. There are many occasions that an iterator is 
backed by some resource (list of lines in a file, list of rows in a database) 
but there is no mechanism in the foreach loop to close this implicit resource. 
This was one thing that C# got right in its implementation, if the iterator 
implements IDisposable then it is disposed. In java it may require an 
additional interface although I doubt that any current Iterators implement 
Closable

2 it would be nice if the foreach loop honoured the RandomAccess semantics but 
it is probably too late for that now

Reply via email to