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

java.util.Optional should evaluate to false if empty

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.5
    • 2.5.0-beta-1
    • None

    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

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

              Dates

                Created:
                Updated:
                Resolved: