On Fri, 15 Apr 2022 13:53:59 GMT, ExE Boss <d...@openjdk.java.net> wrote:

>> Explicitly implement `remove` and `replace` in `IdentityHashMap` to compare 
>> values by identity. Updated API documentation of these two methods 
>> ([Preview](https://cr.openjdk.java.net/~liach/8178355/IdentityHashMap.html#remove(java.lang.Object,java.lang.Object)))
>>  to mention such behavior.
>
> test/jdk/java/util/IdentityHashMap/DefaultRemoveReplace.java line 36:
> 
>> 34:         final String key = "key";
>> 35:         final String internedValue = "value";
>> 36:         final String constructedValue = new String(new char[]{'v', 'a', 
>> 'l', 'u', 'e'});
> 
> Using:
> Suggestion:
> 
>         final String constructedValue = new String(internedValue);
> 
> will allow the internal `String.value` array to be shared: 
> <https://github.com/openjdk/jdk/blob/bdf8a2a2050393e91800786f8d5a5d6805f936eb/src/java.base/share/classes/java/lang/String.java#L259-L265>

I know. This is just to get rid of intellij idea's warning.

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

PR: https://git.openjdk.java.net/jdk/pull/8259

Reply via email to