Groovy web console

subscribe to the feed Subscribe
to this
site

Iterate over map entries, ordered by keys

Published 2 years ago by Valentin with tags map traversal
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def mymap = [A: 1, C: 2, B: 3, D: 4, Z: 5, E: 6]
mymap.sort { it.key }.each { println it}