Get key in groovy maps

try map.keySet()

and if you want an array:

map.keySet() as String[]; // thx @tim_yates

Or, more groovy-ish:

map.each{
    key, value -> print key;
}

Warning: In Jenkins, the groovy-ish example is subtly broken, as it depends on an iterator. Iterators aren’t safe in Jenkins Pipeline code unless wrapped in a @NonCPS function.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)