Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243651

java for-each loop should handle nulls cleanly.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 15
    • specification
    • 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).


            sswsharm swati sharma (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: