Skip to content

Instantly share code, notes, and snippets.

@kyonmm
Created September 12, 2011 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kyonmm/1210726 to your computer and use it in GitHub Desktop.
Save kyonmm/1210726 to your computer and use it in GitHub Desktop.
文字列リストを辞書的に網羅する。
String.metaClass.multiply = {String s ->
delegate+s
}
List.metaClass.multiply = { List l ->
result = []
delegate.each{e1 ->
l.each{e2 ->
result << e1*e2
}
}
return result
}
def r = [*"A".."Z"]+[*"A".."Z"]*[*"A".."Z"]
r.each{println it}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment