RFR: 8186958: Need method to create pre-sized HashMap [v18]
XenoAmess
duke at openjdk.java.net
Thu Apr 14 17:05:42 UTC 2022
On Wed, 13 Apr 2022 23:25:47 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> XenoAmess has updated the pull request incrementally with one additional commit since the last revision:
>>
>> update LastModified
>
> src/java.base/unix/classes/java/lang/ProcessEnvironment.java line 102:
>
>> 100: /* Only for use by Runtime.exec(...String[]envp...) */
>> 101: static Map<String,String> emptyEnvironment(int capacity) {
>> 102: return new StringEnvironment(HashMap.newHashMap(capacity));
>
> This change is correct, since this is called with the length of an array that's used to populate the environment. It really should be named `size` instead of `capacity`. However the windows version of this code simply calls `super(capacity)` as it's a subclass of `HashMap`, which is wrong. Well, probably not worth changing this now. We may need to revisit this later to do some cleaning up. (And also the strange computation in the static initializer at line 71.)
@stuart-marks OK, changes on this class reverted.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7928
More information about the nio-dev
mailing list