changeset 8423:828bddfaf40e

ZipFile::stream should be ORDERED
author henryjen
date Tue, 30 Apr 2013 12:37:17 -0700
parents ff29a0e4ca86
children 7c4898c8b974
files src/share/classes/java/util/jar/JarFile.java src/share/classes/java/util/zip/ZipFile.java
diffstat 2 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/jar/JarFile.java	Mon Apr 29 22:48:07 2013 -0700
+++ b/src/share/classes/java/util/jar/JarFile.java	Tue Apr 30 12:37:17 2013 -0700
@@ -237,27 +237,27 @@
         return null;
     }
 
-    protected class JarEntryIterator implements Enumeration<JarEntry>,
+    private class JarEntryIterator implements Enumeration<JarEntry>,
             Iterator<JarEntry>
     {
-        final Iterator<ZipEntry> e = new ZipFile.ZipEntryIterator();
+        final Enumeration<? extends ZipEntry> e = JarFile.super.entries();
+
+        public boolean hasNext() {
+            return e.hasMoreElements();
+        }
+
+        public JarEntry next() {
+            ZipEntry ze = e.nextElement();
+            return new JarFileEntry(ze);
+        }
 
         public boolean hasMoreElements() {
-            return e.hasNext();
+            return hasNext();
         }
 
         public JarEntry nextElement() {
             return next();
         }
-
-        public boolean hasNext() {
-            return e.hasNext();
-        }
-
-        public JarEntry next() {
-            ZipEntry ze = e.next();
-            return new JarFileEntry(ze);
-        }
     }
 
     /**
@@ -271,7 +271,8 @@
     public Stream<JarEntry> stream() {
         return StreamSupport.stream(Spliterators.spliterator(
                 new JarEntryIterator(), size(),
-                Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+                Spliterator.ORDERED | Spliterator.DISTINCT |
+                        Spliterator.IMMUTABLE | Spliterator.NONNULL));
     }
 
     private class JarFileEntry extends JarEntry {
--- a/src/share/classes/java/util/zip/ZipFile.java	Mon Apr 29 22:48:07 2013 -0700
+++ b/src/share/classes/java/util/zip/ZipFile.java	Tue Apr 30 12:37:17 2013 -0700
@@ -475,7 +475,7 @@
         return name;
     }
 
-    protected class ZipEntryIterator implements Enumeration<ZipEntry>, Iterator<ZipEntry> {
+    private class ZipEntryIterator implements Enumeration<ZipEntry>, Iterator<ZipEntry> {
         private int i = 0;
 
         public ZipEntryIterator() {
@@ -545,7 +545,8 @@
     public Stream<? extends ZipEntry> stream() {
         return StreamSupport.stream(Spliterators.spliterator(
                 new ZipEntryIterator(), size(),
-                Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+                Spliterator.ORDERED | Spliterator.DISTINCT |
+                        Spliterator.IMMUTABLE | Spliterator.NONNULL));
     }
 
     private ZipEntry getZipEntry(String name, long jzentry) {