-
Enhancement
-
Resolution: Won't Fix
-
P5
-
None
-
6
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
Since the request for a unification of enhanced for loops was turned down (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6349852), I suggest the following:
Make java.util.zip.ZipFile implement java.lang.Iterable<ZipEntry>.
JUSTIFICATION :
Make it easier and more consistent with other collection-type objects to iterate over the zip entries.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ZipFile zipFile = new ZipFile("test.zip");
for(ZipEntry entry : zipFile) {
System.out.println(entry.getName());
}
ACTUAL -
ZipFile zipFile = new ZipFile("test.zip");
for(Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements();) {
ZipEntry entry = entries.nextElement();
System.out.println(entry.getName());
}
Since the request for a unification of enhanced for loops was turned down (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6349852), I suggest the following:
Make java.util.zip.ZipFile implement java.lang.Iterable<ZipEntry>.
JUSTIFICATION :
Make it easier and more consistent with other collection-type objects to iterate over the zip entries.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ZipFile zipFile = new ZipFile("test.zip");
for(ZipEntry entry : zipFile) {
System.out.println(entry.getName());
}
ACTUAL -
ZipFile zipFile = new ZipFile("test.zip");
for(Enumeration<? extends ZipEntry> entries = zipFile.entries(); entries.hasMoreElements();) {
ZipEntry entry = entries.nextElement();
System.out.println(entry.getName());
}
- relates to
-
JDK-6349852 Support java.util.Enumeration in enhanced for loop
-
- Closed
-