On Mon, 4 Jul 2022 16:58:05 GMT, Attila Szegedi <[email protected]> wrote:

>> Hm.  For me the previous code is confusing. Subsequent remove+put by the 
>> same key looks like some leftovers after refactoring.
>> Javadoc of this method is very explanatory. New code just repeats what is 
>> written there.  Not sure if additional comment required.
>
> In a context of a linked hash map, remove+put has the effect of reordering. 
> In your refactor there's still a remove+put on the same key, you essentially 
> just hoisted the two common occurrences from both branches to outside the if 
> statement.
> 
> Not to _necessarily_ appeal to authority, but Jon is a true multi-decade 
> veteran of Java language tooling and knows more about Javadoc than most of us 
> combined, so if all he asks for is a comment, I'd add a comment :-). Maybe 
> something to the effect of
> 
> 
> // remove + put in both branches below move the tag to the back of the map's 
> ordering

comment added

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

PR: https://git.openjdk.org/jdk/pull/9137

Reply via email to