I found one similar issue, https://bugs.openjdk.org/browse/JDK-8015008,
but that was for an empty primitive iterator. I've created a bug report
with id 9073784.
On 11/08/2022 01:24, some-java-user-99206970363698485...@vodafonemail.de
wrote:
Hi,
could you please report this at https://bugreport.java.com/bugreport/
(please also first search at
https://bugs.openjdk.org/issues?jql=project%3DJDK%20AND%20issuetype%3DBug
whether it has already been reported).
This also seems to affect the `CheckedEntrySet`; would be good if you could
mention that
in your report as well.
I think the easiest reproducers for this can be created with an empty map:
```
Collections.unmodifiableMap(Map.of()).entrySet().iterator().forEachRemaining(null)
Collections.checkedMap(Map.of(), String.class,
String.class).entrySet().iterator().forEachRemaining(null)
```
Per specification both calls should throw a NullPointerException, but they
don't throw it.
Might also be worth recommending to the JDK authors to perform the null check
in the internal
`entryConsumer` method to avoid having it repeated 4 times, once for each
caller. The `CheckedEntrySet`
would still need a separate null check though.
Kind regards