File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes strange grammar feature Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "strange grammar feature" Watch "strange grammar feature" New topic

strange grammar feature

bernard amadeus

Joined: May 15, 2009
Posts: 21
(I'm a Groovy newbie)
by reading a groovy grammar (
I do not understand the "argument" production
apparentlty there may be something like "*:" as a label .... seen nothing on the web to explain the meaning of that ...
any hint?
sergio ramirez

Joined: Aug 28, 2011
Posts: 4

Hello Bernard!

Nice question!, *. operator is used to spread all elements in a list...

assert ['cat', 'elephant']*.size() == [3, 8]

while *: is used to spread or combine maps, so you could do something like this:

def argMap = [b:2, c:3, d:4]

fancyMethod(a:1, *:argMap) // You can see this complies the "argument" production in the groovy grammar

You could also see this link

Hope this helps!
I agree. Here's the link:
subject: strange grammar feature
It's not a secret anymore!