RFR: 8295323: Unnecessary HashTable usage in StyleSheet

Phil Race prr at openjdk.org
Mon Oct 24 04:45:41 UTC 2022


On Wed, 5 Oct 2022 18:04:41 GMT, SWinxy <duke at openjdk.org> wrote:

>> Hashtable was used only from single thread. And only non-null key/values added to it. We can safely replace it with HashSet.
>
> src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java line 1364:
> 
>> 1362:                            HashSet<SelectorMapping> alreadyChecked) {
>> 1363:         // Avoid descending the same mapping twice.
>> 1364:         if (!alreadyChecked.add(parentMapping)) {
> 
> Clever!

Seriously ? That is your explanation ? Do better.

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

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



More information about the client-libs-dev mailing list