2

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?

marhg
  • 659
  • 1
  • 17
  • 30

1 Answers1

0

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.

Mohammed Aouf Zouag
  • 17,042
  • 4
  • 41
  • 67
  • I decided to add the code. Could you please have a look. http://stackoverflow.com/questions/33632090/map-collection-separate-object-values-part2 Thank you. If possible could you write down an example Thank you – marhg Nov 10 '15 at 14:19