映射集合单独的对象值 [英] Map collection separate Object values
本文介绍了映射集合单独的对象值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Map集合,将stops作为Key和一组网格和时间结果存储为Object值。例如
键:[stops]
pre>
值:[[{grid_item = Grid1,time = 09:30} {grid_item = Grid13,time = 10:00},{grid_item = Grid3,time = 10:15},{grid_item = Grid10,time = 10:35}]]
有一种方法来分隔Value结果,因为我想使用grid_item和时间将它们发送到另一个方法。如何获得这些值具体?
或者我应该再次存储在地图中的值,但现在的键是grid_item和时间。
解决方案任何建议?您可以通过这种方式访问
值
的特定对象:map.get(stops)[0] // grid_item = Grid1,time = 09:30
map.get(stops)[1] // grid_item = Grid13,time = 10:00
....
其中
停止
键。I have a Map collection that stores "stops" as Key and a set of grid and time results as an Object value. e.g.
Key: [stops] Value: [[{grid_item=Grid1, time=09:30}, {grid_item=Grid13, time=10:00}, {grid_item=Grid3, time=10:15}, {grid_item=Grid10, time=10:35}]]
Is there a way to separate the Value results, because i would like to use the grid_item and time to send them to another method. How can i get those values specifically?
Or should i store again the values in a Map but now the keys are grid_item and time. But how can i do that?
Any Suggestions?
解决方案You can access a specific object in your
value
's array this way:map.get(stops)[0] // grid_item=Grid1, time=09:30 map.get(stops)[1] // grid_item=Grid13, time=10:00 ....
where
stops
is the key that you are using.这篇关于映射集合单独的对象值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文