• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GPath spread operator (*.) and another GinA example

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again.
I'm slowly getting there with groovy and working through the example listings in GinA but this time I think I really have found an example that doesn't work with the latest version.

Listing : 7.23


I'm guessing this doesn't work because GinA assumes 1.0 and I'm on 1.6.5.

I found this bug http://jira.codehaus.org/browse/GROOVY-2387 which recommends replacing the last line with


An obvious question is where did sum() come from?

Can anyone explain how I should be using spread (*.) operator in the later version of groovy as it seems like a really powerful feature

My final question is, are there many of these gotchas in the groovy GDK which newbies should be aware of ?

Kris
 
Kristian Jones
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the following on the authors website : http://www.manning-sandbox.com/thread.jspa?threadID=33351&tstart=0

.flattern() works too.
 
author
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sum() is a method on Collection after it's been enhanced by the GDK. It was there in 1.0 but new over-ridden versions were included in 1.5 and above. You can read more about it and find many other hiddend Groovy nuggets in the GDK docs: http://groovy.codehaus.org/groovy-jdk. This doc will show you all the nifty features added to JDK classes / interfaces.

Have fun!
Dave
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic