Last active
June 18, 2024 14:06
-
-
Save ilmoralito/6801027 to your computer and use it in GitHub Desktop.
Groovy get all keys in a map
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
def map = [language:"groovy", framework:"grails"] | |
def keys = map.keySet() as List | |
assert ["language", "framework"] == keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Intuitively I thought that since someMap.values() works, someMap.keys() would work as well. Anyway, gotta use that keySet() instead. Thanks for sharing!