RFR: JDK-8189611: JarFile versioned stream and real name support

Alan Bateman Alan.Bateman at oracle.com
Mon Nov 20 15:27:43 UTC 2017

On 17/11/2017 16:53, Xueming Shen wrote:
> :
>> 3. Is ZipFile.entryNameStream really needed? Just asking because 
>> zf.stream().map(ZipEntry::getName) is possible today.
> It's not a "must" for sure. The motivation behind this is that my 
> observation of most normal use scenario
> inside JDK is that only the "name" info is interested/collect/used. 
> The use pattern usually is
> zf.stream().map(ZipEntry::getName)
> same for the old Enumeration case, only the "name" is used and the 
> "entry" object is thrown away mostly.
> Other than the memory consumption (showed in those two snapshots), 
> it's also relatively costly to create
> the ZipEntry especially its "esxdostime" calculation. The jmh numbers 
> from a simple benchmark test
> suggests the entryNameStream is about 15-20% faster. So, the only 
> reason it's there is for better
> performance.
I can believe that it is faster but it does loose the ability to filter 
(it requires checking for a trailing "/" to filter out directories for 
example). I guess I don't object to adding this but it feels like it an 
opportunity beyond JDK-8189611.


More information about the core-libs-dev mailing list