summaryrefslogtreecommitdiff
path: root/src/main/org/apache/tools/ant/types/ZipScanner.java
diff options
context:
space:
mode:
authorGintas Grigelionis <gintas@apache.org>2018-05-17 20:36:11 +0200
committerGintas Grigelionis <gintas@apache.org>2018-05-17 20:36:11 +0200
commit11422630936848e82c7b13ab3fa68a3003e10195 (patch)
tree43d10e329bc94656c919b49f6798521ea12ed1ca /src/main/org/apache/tools/ant/types/ZipScanner.java
parent0020d1a16ba4207289d2380dc6981c85455b617f (diff)
downloadant-11422630936848e82c7b13ab3fa68a3003e10195.tar.gz
Avoid Collections.list().stream()
(for performance sake)
Diffstat (limited to 'src/main/org/apache/tools/ant/types/ZipScanner.java')
-rw-r--r--src/main/org/apache/tools/ant/types/ZipScanner.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/org/apache/tools/ant/types/ZipScanner.java b/src/main/org/apache/tools/ant/types/ZipScanner.java
index 566715936..f43fa7c65 100644
--- a/src/main/org/apache/tools/ant/types/ZipScanner.java
+++ b/src/main/org/apache/tools/ant/types/ZipScanner.java
@@ -20,14 +20,13 @@ package org.apache.tools.ant.types;
import java.io.File;
import java.io.IOException;
-import java.util.Collections;
import java.util.Map;
import java.util.zip.ZipException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.resources.FileProvider;
import org.apache.tools.ant.types.resources.ZipResource;
-import org.apache.tools.zip.ZipEntry;
+import org.apache.tools.ant.util.StreamUtils;
import org.apache.tools.zip.ZipFile;
/**
@@ -62,7 +61,7 @@ public class ZipScanner extends ArchiveScanner {
"Only file provider resources are supported"));
try (ZipFile zf = new ZipFile(srcFile, encoding)) {
- for (ZipEntry entry : Collections.list(zf.getEntries())) {
+ StreamUtils.enumerationAsStream(zf.getEntries()).forEach(entry -> {
Resource r = new ZipResource(srcFile, encoding, entry);
String name = entry.getName();
if (entry.isDirectory()) {
@@ -77,7 +76,7 @@ public class ZipScanner extends ArchiveScanner {
matchFileEntries.put(name, r);
}
}
- }
+ });
} catch (ZipException ex) {
throw new BuildException("Problem reading " + srcFile, ex);
} catch (IOException ex) {