RFR: 8186958: Need method to create pre-sized HashMap [v18]

Joe Wang joehw at openjdk.java.net
Thu Apr 14 03:31:15 UTC 2022


On Thu, 14 Apr 2022 01:15:05 GMT, XenoAmess <duke at openjdk.java.net> wrote:

>> src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/DocumentCache.java line 171:
>> 
>>> 169:         _current = 0;
>>> 170:         _size  = size;
>>> 171:         _references = HashMap.newHashMap(_size);
>> 
>> Not `_size+2` ?
>
>> Not `_size+2` ?
> 
> I don't have a idea here why he original use the + 2.
> Is there any guy more familiar with this code tell me why?
> Thanks!

size, not size + 2, same situation as size*2+1 below.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7928


More information about the security-dev mailing list