Skip to content

Commit

Permalink
Merge pull request #279 from csobrinho/patch-1
Browse files Browse the repository at this point in the history
Fix a bottleneck. If the jar entries is big, List.contains is O(n) an…
  • Loading branch information
chibash committed Oct 11, 2019
2 parents 3062791 + 7279bda commit a54eae5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/javassist/ClassPoolTail.java
Expand Up @@ -25,9 +25,9 @@
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;

Expand Down Expand Up @@ -128,14 +128,14 @@ public URL find(String classname) {
}

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());
Expand Down

0 comments on commit a54eae5

Please sign in to comment.