Skip to content

Instantly share code, notes, and snippets.

@lospejos
Forked from danieldbower/retainAllExample.groovy
Created December 4, 2017 11:33
Show Gist options
  • Save lospejos/060e38f5624d97a307a246e172e9d792 to your computer and use it in GitHub Desktop.
Save lospejos/060e38f5624d97a307a246e172e9d792 to your computer and use it in GitHub Desktop.
Groovy retainAll example with Closure
def a = [[id:"a"], [id:"b"], [id:"c"]]
def b = ["a", "b"]
a.retainAll(){
println it
b.contains(it.id)
}
println a
println b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment