Enumeration and Iterable
November 25th, 2007 by SamWhy does the aged (and ridiculously verbose) Enumeration not have a sub-interface that implements Iterable… and then make all J2SE classes return the sub-interface so that we could use older classes in the enhanced for loop like this
for (ZipEntry entry : zip.entries()){
// do stuff
}
It seems like a no-brainer, and wouldn’t break backwards compatibility. Collections.list just doesn’t quite cut it for me (too verbose, and requires creating a list).
for (ZipEntry entry : Collections.list(zip.entries())) {
// do stuff
}
Update: I somehow managed to miss Stephan’s recent post and Binkley’s older post.
Stephan Schmidt wrote:
November 25th, 2007 at 8:00 pm