-
-
Save lospejos/060e38f5624d97a307a246e172e9d792 to your computer and use it in GitHub Desktop.
Groovy retainAll example with Closure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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