git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [1/2] ant git commit: Deprecate CollectionUtils and Enumerations; reduce explicit use of Enumeration


Thanks for reviewing, I hope Spliterators will do a better job.

Gintas

2018-05-17 8:37 GMT+02:00 Jaikiran Pai <jai.forums2013@xxxxxxxxx>:

> 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
> with.
>
> -Jaikiran
>
>
>
> 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.
>> Maarten
>>
>>        Van: "gintas@xxxxxxxxxx" <gintas@xxxxxxxxxx>
>>   Aan: notifications@xxxxxxxxxxxxxx
>>   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
>>
>>
>> http://git-wip-us.apache.org/repos/asf/ant/blob/070c3bc8/src
>> /main/org/apache/tools/ant/types/ZipScanner.java
>> ----------------------------------------------------------------------
>> diff --git a/src/main/org/apache/tools/ant/types/ZipScanner.java
>> b/src/main/org/apache/tools/ant/types/ZipScanner.java
>> index a3df040..5667159 100644
>> --- a/src/main/org/apache/tools/ant/types/ZipScanner.java
>> +++ b/src/main/org/apache/tools/ant/types/ZipScanner.java
>> @@ -20,7 +20,7 @@ package org.apache.tools.ant.types;
>>     import java.io.File;
>>   import java.io.IOException;
>> -import java.util.Enumeration;
>> +import java.util.Collections;
>>   import java.util.Map;
>>   import java.util.zip.ZipException;
>>   @@ -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: dev-unsubscribe@xxxxxxxxxxxxxx
> For additional commands, e-mail: dev-help@xxxxxxxxxxxxxx
>
>


( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-ant-development/msg01945.html on line 135
Call Stack
#TimeMemoryFunctionLocation
10.0008368736{main}( ).../msg01945.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-ant-development/msg01945.html on line 135
Call Stack
#TimeMemoryFunctionLocation
10.0008368736{main}( ).../msg01945.html:0