groovy
  1. groovy
  2. GROOVY-811

empty Map should evaluate to false in asBool()

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0-JSR-1
    • Fix Version/s: 1.0-JSR-2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      > - analogous to Collections, an empty Map should
      > evaluate to false.

        Activity

        Hide
        Kim, Pilho added a comment -

        This issue has been fixed and is closed.

        For an example,
        emptyMap = [:]
        assert (emptyMap as Boolean) == false
        if (emptyMap)
        println("emotyMap is true!")
        else
        println("emotyMap is false!")

        For details, see test/groovy/bugs/AsBoolBug.groovy.

        Show
        Kim, Pilho added a comment - This issue has been fixed and is closed. For an example, emptyMap = [:] assert (emptyMap as Boolean) == false if (emptyMap) println("emotyMap is true!") else println("emotyMap is false!") For details, see test/groovy/bugs/AsBoolBug.groovy.

          People

          • Assignee:
            Kim, Pilho
            Reporter:
            Dierk König
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: