You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
The foreach statement is just syntactic sugar which is expanded into for with an iterator. Therefore, if the iterable is null, the code fails with a NullPointerException.
I think it would be nice to make the loop handle null as an empty container.
Code such as
foreach elt in elements {
workWith(elt)}
would be expanded in
for(let it=elements?:iterator(), it isnt null and it: hasNext(), ){let elt = it: next()
workWith(elt)}
The text was updated successfully, but these errors were encountered:
The
foreach
statement is just syntactic sugar which is expanded intofor
with an iterator. Therefore, if the iterable isnull
, the code fails with aNullPointerException
.I think it would be nice to make the loop handle
null
as an empty container.Code such as
would be expanded in
The text was updated successfully, but these errors were encountered: