diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2019-10-12 02:08:33 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-12 02:08:33 +0900 |
commit | a54eae58dfd72d079534da25c1d8871a54b5723c (patch) | |
tree | 597ec66dab99fa65284c2fdd4c746e2d2afbdb61 | |
parent | 30627914d3f40b9a9bf88f57cd616e70dfdda97f (diff) | |
parent | 7279bda2277d772ea8da2ae31e31dd183f84c609 (diff) | |
download | javassist-a54eae58dfd72d079534da25c1d8871a54b5723c.tar.gz javassist-a54eae58dfd72d079534da25c1d8871a54b5723c.zip |
Merge pull request #279 from csobrinho/patch-1
Fix a bottleneck. If the jar entries is big, List.contains is O(n) an…
-rw-r--r-- | src/main/javassist/ClassPoolTail.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/javassist/ClassPoolTail.java b/src/main/javassist/ClassPoolTail.java index d9d2198e..72fa390c 100644 --- a/src/main/javassist/ClassPoolTail.java +++ b/src/main/javassist/ClassPoolTail.java @@ -25,9 +25,9 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; import java.util.Collections; -import java.util.List; +import java.util.HashSet; +import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -128,14 +128,14 @@ final class JarDirClassPath implements ClassPath { } final class JarClassPath implements ClassPath { - List<String> jarfileEntries; + Set<String> jarfileEntries; String jarfileURL; JarClassPath(String pathname) throws NotFoundException { JarFile jarfile = null; try { jarfile = new JarFile(pathname); - jarfileEntries = new ArrayList<String>(); + jarfileEntries = new HashSet<String>(); for (JarEntry je:Collections.list(jarfile.entries())) if (je.getName().endsWith(".class")) jarfileEntries.add(je.getName()); |