Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7611

java.util.Optional should evaluate to false if empty

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.5.0-beta-1
    • Component/s: None
    • Labels:

      Description

      In the spirit of the rest of the Groovy truth semantics, I suggest that an empty java.util.Optional, which is essentially a stream-safe equivalent of null, should evaluate to false: asBoolean() should simply delegate to isPresent().

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jwagenleitner John Wagenleitner
                Reporter:
                chrylis Christopher Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: