Skip to content

Instantly share code, notes, and snippets.

@ilmoralito
Last active June 18, 2024 14:06
Show Gist options
  • Save ilmoralito/6801027 to your computer and use it in GitHub Desktop.
Save ilmoralito/6801027 to your computer and use it in GitHub Desktop.
Groovy get all keys in a map
def map = [language:"groovy", framework:"grails"]
def keys = map.keySet() as List
assert ["language", "framework"] == keys
@nbkhope
Copy link

nbkhope commented Dec 29, 2016

Intuitively I thought that since someMap.values() works, someMap.keys() would work as well. Anyway, gotta use that keySet() instead. Thanks for sharing!

@sonny-semc
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment