On Wed, 8 Apr 2026 21:52:29 GMT, Naoto Sato <[email protected]> wrote:

> What if tags contains null element, but matching element enumerates earlier 
> in the Collection? Looks like the implementation simply returns when the 
> matching one comes first in the loop, not caring the null in the rest of the 
> collection.

@naotoj You're right. I wanted to keep the checks out of the standard-path case 
if possible. But it looks like to ensure this behavior for an early match (and 
possible subsequent null elements later), we will need to validate all cases 
up-front. One alternative is weakening the specified NullPointerException to 
"_may throw_" for null elements within the collections, if the up-front 
performance cost is a concern.

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

PR Comment: https://git.openjdk.org/jdk/pull/30632#issuecomment-4210022864

Reply via email to