How to extract a new list from an object field in Groovy

前端 未结 1 570
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-18 18:45

In Groovy, how do I extract a new list from the following:

   def people = [ 
           new Person(name:\"Tom\", yearOfBirth:1985),
           new Person(name:\         


        
1条回答
  •  执念已碎
    2021-02-18 19:25

    You can do:

    def names = people.name
    

    0 讨论(0)
提交回复
热议问题