On Fri, 8 Mar 2024 23:17:28 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Optimize performance of OpenAddressed Set just in case it is ever used
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/FixedCapacitySet.java
>  line 215:
> 
>> 213:         @Override
>> 214:         public int hashCode() {
>> 215:             return element == null ? 0 : element.hashCode();
> 
> very minor: should we mix in the class hashCode?  ex:
> `return Objects.hashCode(Single.class, element);`

We can't, `hashCode` for `Set`s are specified:

> The hash code of a set is defined to be the sum of the hash codes of the 
> elements in the set, where the hash code of a {@code null} element is defined 
> to be zero

This is done so that using a set as a key would hash to the same value 
regardless of what type of set it is.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1316#discussion_r1518482891

Reply via email to