LoginSignup
1

More than 5 years have passed since last update.

posted at

updated at

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

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

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

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

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
What you can do with signing up
1