Obtener clave en mapas groovy
def map = [name:"Gromit", likes:"cheese", id:1234]
Me gustaría acceder al mapa de tal manera que pueda obtener la clave
Algo así como la salida debe ser
Mapa.keys devuelve la matriz de cadena. básicamente solo quiero obtener las llaves
Salida:
name
likes
id
38
Author: Sean Patrick Floyd, 2011-02-04
1 answers
Intente map.keySet()
Y si quieres un array:
map.keySet() as String[]; // thx @tim_yates
O, más groovy-ish:
map.each{
key, value -> print key;
}
57
Author: Sean Patrick Floyd,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-02-04 13:09:14
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-02-04 13:09:14