You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2013/05/29 14:59:44 UTC
svn commit: r1487468 -
/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Author: bodewig
Date: Wed May 29 12:59:44 2013
New Revision: 1487468
URL: http://svn.apache.org/r1487468
Log:
use LinkedList explicitly for the tiny gain getFirst() provides over get(0)
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=1487468&r1=1487467&r2=1487468&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Wed May 29 12:59:44 2013
@@ -94,8 +94,8 @@ public class ZipFile {
/**
* Maps String to list of ZipArchiveEntrys, name -> actual entries.
*/
- private final Map<String, List<ZipArchiveEntry>> nameMap =
- new HashMap<String, List<ZipArchiveEntry>>(HASH_SIZE);
+ private final Map<String, LinkedList<ZipArchiveEntry>> nameMap =
+ new HashMap<String, LinkedList<ZipArchiveEntry>>(HASH_SIZE);
private static final class OffsetEntry {
private long headerOffset = -1;
@@ -307,8 +307,8 @@ public class ZipFile {
* {@code null} if not present.
*/
public ZipArchiveEntry getEntry(String name) {
- List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
- return entriesOfThatName != null ? entriesOfThatName.get(0) : null;
+ LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
+ return entriesOfThatName != null ? entriesOfThatName.getFirst() : null;
}
/**
@@ -925,12 +925,12 @@ public class ZipFile {
}
String name = ze.getName();
- List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
+ LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
if (entriesOfThatName == null) {
entriesOfThatName = new LinkedList<ZipArchiveEntry>();
nameMap.put(name, entriesOfThatName);
}
- entriesOfThatName.add(ze);
+ entriesOfThatName.addLast(ze);
}
}