Skip to content

Instantly share code, notes, and snippets.

@gdevanla
Created February 7, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdevanla/8862014 to your computer and use it in GitHub Desktop.
Save gdevanla/8862014 to your computer and use it in GitHub Desktop.
// does a product on two lists
h = [ 1: "a", 2:"b", 3:"c"]
j = [ 1: ["x", "p"], 2: ["z"], 3:["y"]]
h.entrySet().inject([]) { acc, h1 ->
acc + j.get(h1.key).inject([]) { acc1, it-> acc1 << [h1.value, it]} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment