PKWARE-APPNOTE-6.3.9.txt states:

4.3.14  Zip64 end of central directory record
  ...
  total number of entries in the central directory           8 bytes

4.3.16  End of central directory record:
  ...
  total number of entries in the central directory           2 bytes

Yet the list to keep track of those entries in ZipFile is a LinkedList:

private final List<ZipArchiveEntry> entries = new LinkedList<>();

Would it not be more efficient with an ArrayList whose initial capacity matches 
the total number of entries
stated in the end of directory record? Assuming the total number of entries <= 
Integer.MAX_VALUE – 8
of course (see https://www.baeldung.com/java-arrays-max-size).

This would also open the way for adding an option to have the ZipFile entry 
list sorted *in-place*
 in physical order, which eliminates the needs to allocate yet another large 
array in getEntriesInPhysicalOrder when dealing with zip files containing many 
entries.

-- 
 Sent with Tutanota, the secure & ad-free mailbox. 

Reply via email to