Map with Key as String and Value as List in Groovy

前端 未结 5 606
慢半拍i
慢半拍i 2021-02-03 18:54

Can anyone point me to an example of how to use a Map in Groovy which has a String as its key and a List as value?

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 19:18

    you don't need to declare Map groovy internally recognizes it

    def personDetails = [firstName:'John', lastName:'Doe', fullName:'John Doe']
    
    // print the values..
        println "First Name: ${personDetails.firstName}"
        println "Last Name: ${personDetails.lastName}"
    

    http://grails.asia/groovy-map-tutorial

提交回复
热议问题