equals inconsistent with hashCode in AffineTransform
Kevin Rushforth
kevin.rushforth at oracle.com
Mon Jul 25 12:29:37 UTC 2022
On 7/25/2022 5:12 AM, Lothar Kimmeringer wrote:
>
>
> Am 25.07.2022 um 14:04 schrieb Martin Desruisseaux:
>
>> This bug prevents the use of AffineTransform as keys in HashMap, unless
>> AffineTransform construction is well-controlled or some workaround is
>> applied before any use as key.
>
> AffineTransform isn't immutable so it can't be used as key in Maps
> anyway.
That's not quite right. Mutable object can, and frequently are, used in
Maps, as long as you don't mutate them while they are in a Map. Without
commenting on this specific PR, it is still a best practice for hashCode
and equals to be consistent for mutable objects.
-- Kevin
>
>
> Best regards,
>
> Lothar Kimmeringer
More information about the client-libs-dev
mailing list