Last active
August 29, 2015 14:11
-
-
Save bobbywarner/542df1eb6668c5651336 to your computer and use it in GitHub Desktop.
Groovy SubMap
This file contains hidden or 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
| Map foo = [1: "one", 2: "two"] | |
| Map bar = [1: "one"] | |
| assert [1: "one"] == foo.subMap( bar.collect { it.key }) | |
| Map foo2 = [1: "one", 2: "two"] | |
| Map bar2 = [1: "one", 2: "two", 3: "three"] | |
| assert [1:"one", 2:"two"] == foo2.subMap( bar2.collect { it.key }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment