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

Unable to use spread operator with maps

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.5.5, 1.6-beta-1
    • None
    • None
    • Groovy 1.5.4, Java 6

    Description

      Try to run the following lines:

        def map = [A:"one", B:"two", C:"three"]
        
        def list = map.collect { child ->  child.value.toUpperCase() }
        def list2 = map*.value?.toUpperCase()
        
        status.out.println list
        status.out.println list2
      

      The first collect statement runs well. So, we expected the one which fills list2 to be equivalent.
      But the result is not the same. After running the script, list2 becomes null.

      Attachments

        Activity

          People

            paulk Paul King
            vinigodoy Vinícius Godoy de Mendonça
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: