On Fri, 15 Apr 2022 05:58:32 GMT, liach <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. src/java.base/share/classes/java/util/IdentityHashMap.java line 1412: > 1410: i = nextKeyIndex(i, len); > 1411: } > 1412: } Unfortunately there's some mostly-duplicate code here. However, there's similar logic and code sprinkled throughout this class, so _more_ duplication isn't necessarily the wrong thing to do. However, trying to unify this logic results in much more intrusive refactoring, which is harder to review, and which isn't backed up with tests (see JDK-8285295) which I wouldn't encourage pursuing right now. In other words, I'm ok with this duplicate logic. ------------- PR: https://git.openjdk.java.net/jdk/pull/8259