On Wed, 29 Jun 2022 08:20:31 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:
>> There is overload method HashMap.remove(key,value) which also checks value >> equality. >> It's shorter and faster than pair get+remove. > > Andrey Turbanov has updated the pull request incrementally with one > additional commit since the last revision: > > 8289431: (zipfs) Avoid redundant HashMap.get in > ZipFileSystemProvider.removeFileSystem > update copyright year Hello Andrey, The `HashMap.remove(k, v)` uses `equals()` call to do a equality check on the passed value unlike the if condition here. Right now, the `ZipFileSystem` (the value type) doesn't have an `equals()` implementation of its own and instead the `Object.equals()` gets used, which does the instance identity check. So this change should be fine. I personally prefer the previous/existing version because it's bit more intuitive to understand that the specific instance of filesystem is being removed. No objections to this change if others prefer this new version. ------------- PR: https://git.openjdk.org/jdk/pull/9314