To be honest, I don't think this deprecation/conversion change is good(including this recent commit whichintroduces a StreamUtils.enumerationAsStream(...))

To give you an example, the code that was previously present would (in most of the cases) get hold of an enumeration and would iterate over it and during that iteration would runcertain logic. With the changes that went in (which again is a bulk change!) the code now gets hold of an enumeration and instead of just getting on the business of iterating and running certain logic, instead now passes this enumeration aroundto convert it into some other form (thus additional code plus additional objects allocated in the process), all this to iterate over it and run some logic on it - all of which was already possible with the enumeration that was already available.


On 18/05/18 12:22 AM, Gintautas Grigelionis wrote:
Thanks for reviewing, I hope Spliterators will do a better job.


2018-05-17 8:37 GMT+02:00 Jaikiran Pai <>:

I agree. Especially when it's being done on something like for archive
entries which can betoo many depending on the archive that is being dealt


On 17/05/18 12:04 PM, Maarten Coene wrote:

Converting an Enumeration to a List just for iterating it doesn't seem
performance and memory wise a good idea to me.

        Van: "" <>
   Verzonden: woensdag 16 mei 19:13 2018
   Onderwerp: [1/2] ant git commit: Deprecate CollectionUtils and
Enumerations; reduce explicit use of Enumeration
     Repository: ant
Updated Branches:
    refs/heads/master ac35c0014 -> 070c3bc86
diff --git a/src/main/org/apache/tools/ant/types/
index a3df040..5667159 100644
--- a/src/main/org/apache/tools/ant/types/
+++ b/src/main/org/apache/tools/ant/types/
@@ -20,7 +20,7 @@ package;
-import java.util.Enumeration;
+import java.util.Collections;
   import java.util.Map;
   @@ -62,10 +62,7 @@ public class ZipScanner extends ArchiveScanner {
                  "Only file provider resources are supported"));
            try (ZipFile zf = new ZipFile(srcFile, encoding)) {
-            Enumeration<ZipEntry> e = zf.getEntries();
-            while (e.hasMoreElements()) {
-                ZipEntry entry = e.nextElement();
+            for (ZipEntry entry : Collections.list(zf.getEntries())) {
                  Resource r = new ZipResource(srcFile, encoding, entry);
                  String name = entry.getName();
                  if (entry.isDirectory()) {

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to