RFR: 8315850: Improve AbstractMap anonymous Iterator classes [v3]
altrisi
duke at openjdk.org
Fri Sep 8 18:58:39 UTC 2023
On Fri, 8 Sep 2023 16:13:16 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes to slightly improve some iterators of `AbstractMap`:
>>
>> * Code reuse
>> * A field declared `final`
>> * Add missing `@Override` annotations
>
> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>
> - Fix additional formating issue
> - Don't use polymorphism and reformat code
With the recent changes this ends up just moving the iterator classes around (from anonymous to inner) and making a field final. I don't understand how fully splitting them (vs the previous `AbstractIterator` revision) helps against polymorphism, given they both would store the same `Iterator` types in the field (whatever the result of `entrySet` is), and the `next` method is two different implementations anyway, that I'd assume would be treated differently. Though I don't know enough about the JIT (or benchmarked this) to know if it does make a difference.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15615#issuecomment-1712097625
More information about the core-libs-dev
mailing list