RFR: 8316493: Make immutable maps @ValueBased [v5]
Per Minborg
pminborg at openjdk.org
Wed Oct 18 15:18:15 UTC 2023
On Tue, 19 Sep 2023 23:48:07 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/util/AbstractMap.java line 375:
>>
>>> 373: */
>>> 374: public Collection<V> values() {
>>> 375: return new AbstractCollection<>() {
>>
>> Note that this causes `m.values().equals(m.values())` to no longer return `true`, as base `Collection::equals` is defined using reference equality.
>
> Looking at the specification above:
>> No synchronization is performed, so there is a slight chance that multiple calls to this method will not all return the same collection.
>
> This should be an acceptable change to behavior.
This is brought to attention in the CSR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15614#discussion_r1364066788
More information about the core-libs-dev
mailing list