-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
15
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
java for-each loop throws a NullPointerException when a null collection is passed in. Instead, it should act like it does for an empty collection and just exit the loop cleanly. This would reduce a lot of boilerplate code that either has to check for null values, use Optionals, or the use of third party software (eg apache.commons).
java for-each loop throws a NullPointerException when a null collection is passed in. Instead, it should act like it does for an empty collection and just exit the loop cleanly. This would reduce a lot of boilerplate code that either has to check for null values, use Optionals, or the use of third party software (eg apache.commons).
- duplicates
-
JDK-6341875 New for loop should treat null as an empty list
-
- Closed
-
- relates to
-
JDK-6341875 New for loop should treat null as an empty list
-
- Closed
-