0
これを行うにはどのような方法がありますか?入れ子になったプロパティから合計を得るGroovier方法
def totalSightings=0;
year.months.each{month->
month.weeks.each{week->
week.days.each{day->
total+=day.sightings;
}
}
}
これを行うにはどのような方法がありますか?入れ子になったプロパティから合計を得るGroovier方法
def totalSightings=0;
year.months.each{month->
month.weeks.each{week->
week.days.each{day->
total+=day.sightings;
}
}
}
year.months.weeks.days.sightings.flatten().sum()
Hooah。ありがとうございました。 – user2782001