LoginSignup
1
1

More than 5 years have passed since last update.

クロージャで可変長引数を使う。

Last updated at Posted at 2012-09-15

あれ?Groovyのクロージャで可変長引数って使えたっけ?
と思ってやってみたらできた。

def testclj = {... arg ->
    println arg.each{ println it }
    println arg.class
}
testclj(1,3,6)

/*
結果:
1
3
6
class [Ljava.lang.Object;
*/
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1