def map = [name:"Gromit", likes:"cheese", id:1234]
I would like to access map in such a way that I can get the key
something like the output should be
map.keys returns array of string. basically i just want to get the keys
output:
name
likes
id
|
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;
}
|
|
answered Feb 4 '11 at 12:42
|
|
Get the last key of a Map
map.keySet().last() or map.keySet()[-1]
Get sub-map consists of the last key-value of a Map
map.subMap(map.keySet().last())
Get sub-map except the last key-value
map.minus(map.subMap(map.keySet().last()))
Get the last item of a list
list.last()
Get the sub-list without the last element
list.take(list.size()-1) or list[0..list.size()-1]
分享到:
相关推荐
《Semantic 3D Object Maps for Everyday Manipulation in Human Living Environments》是一本关于如何构建并应用3D点云数据来实现机器人自主操作的重要著作。本书作者Radu Bogdan Rusu在该领域做出了显著贡献,并...
Approaches to Probabilistic Model Learning for Mobile Manipulation Robots,本书是概率模型应用于机器人方面不可多得的资料,作者Jürgen Sturm ,Springer-Verlag Berlin Heidelberg (2013)
SQL Queries for Mere Mortals has earned worldwide praise as the clearest, simplest tutorial on writing effective queries with the latest SQL standards and database applications. Now, author John L. ...
DICOM(Digital Imaging and Communications in Medicine)是一种标准格式,用于在医疗环境中存储、传输和处理医学影像数据。MATLAB是一款强大的数学计算软件,它提供了丰富的工具箱,包括对DICOM数据进行操作的功能...
In deriving the dynamics, we will make explicit use of twists for repre- senting the kinematics of the manipulator and explore the role that the kinematics play in the equations of motion. We assume ...
在本问题中,我们聚焦于一个特定的场景:在ROS Noetic中尝试编译MoveIt时遇到的错误,提示缺少"manipulation_msgs"软件包。 MoveIt是ROS中的一个核心组件,专门用于机器人运动规划、模拟和控制。它包含了一系列用于...
Data Manipulation with R, is aimed at giving intermediate-to-advanced level users of R (who have knowledge about datasets) an opportunity to use state-of-the-art approaches in data manipulation....
Wordlist manipulation; Raptor is known to security experts for its outstanding features for years. Raptor 3 benefits of the experience gained since 1998 when the first version was released and was ...
Wolfgang Engel’s GPU Pro 360 Guide to Geometry ...such subdivision surfaces, which has been used for the key assets in Call of Duty on the Playstation 4 and runs at FullHD at 60 frames per second.
A Mathematical Introduction to Robotic Manipulation Richard M. Murray, Zexiang Li and S. Shankar Sastry
标题"StringManipulation"暗示我们将讨论的是关于字符串处理的各种技巧和方法。在这个特定的场景中,我们聚焦于两种常见的命名规范——驼峰式命名(CamelCase)和下划线命名(UnderlineCase),以及字符串的大小写...
本压缩包"String manipulation operations in java.zip"中的内容可能是一个关于Java字符串操作的项目或教程,其中特别提到了`underscore.string.java-master`这个子文件,暗示了它可能使用了`underscore.string`库来...
Data-Manipulation-in-Python---Master-Python-NumPy-and-Pandas-main
### AS-rigid-as-possible Shape Manipulation #### 概述 本文介绍了一种名为“AS-rigid-as-possible Shape Manipulation”的技术,该技术旨在构建一个实时交互式系统,允许用户移动并改变二维图像的形状。该技术...
标题中的"Image-manipulation-detection"涉及到的是图像篡改检测技术,这是一项重要的信息安全领域技术,用于识别和定位图像是否被人为修改过。在数字图像广泛应用的今天,这项技术对于防止假新闻、欺诈和保护知识...
ThA06 Deep Learning in Grasping and Manipulation II.rar
在Windows Mobile 5.0操作系统中,图像处理技术是一个关键的组成部分,特别是在移动设备上,它使得用户可以方便地拍摄、编辑和分享照片。本文将深入探讨Windows Mobile 5.0中的图像操作,包括基本的图像加载、显示、...