Android Question Map of maps

jccordier

Member
Licensed User
Hello.
First, happy new year, everybody
Next, my question :
I have a map where values are maps. I want to create a new map with one of these values.
I can't do something like : newMap = superMap.get(aKey)
How can I do that ?
Thanks for your help.
 

jccordier

Member
Licensed User
Thank you Erel.
With this code, I get this error :
java.lang.RuntimeException: Object should first be initialized (Map).
I suppose that newMap.initialize create an empty map.
I get the same error with this code :
B4X:
newMap.Initialize
newMap = superMap.Get(aKey)
 
Upvote 0

jccordier

Member
Licensed User
superMap is quite big (more than 200ko).
Here is the begining :
B4X:
(MyMap) {0={ABATE=[0, 1], NICOLÒ=[0, 1], DELL=[0, 1], AELST=[2, 3], PIETER=[2, 254, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 308, 357, 401, 473, 571, 594, 595, 997, 1172, 1173, 1232, 1382, 1383, 1384, 1399, 1411, 1412, 1600, 1905, 1948, 1949, 2007, 2008, 2009, 2010, 2011, 2021, 2138, 2180, 2464, 2539, 2540, 2541, 2542, 2543, 2551, 2564, 2917, 2968, 2983, 3003], COECKE=[2], VAN=[2, 3, 5, 109, 110, 126, 223, 234, 235, 236, 237, 254, 255, 257, 258, 305, 307, 308, 369, 370, 371, 374, 375, 423, 574, 575, 576, 577, 578, 579, 580, 581, 703, 704, 705, 706, 735, 739, 740, 850, 851, 866, 949, 965, 966, 980, 986, 988, 989, 990, 991, 993, 997, 999, 1104, 1105, 1106, 1107, 1108, 1109,
There are 6 keys (0,1,2...) and the values are maps. In these maps, the keys are words.
Maybe an array of maps is easier to handle (not sure), but I read my superMap from a file with ReadMap.
 
Upvote 0

jccordier

Member
Licensed User
For Each K As Object In superMap.Keys
Log(K)
Log("Key type: " & GetType(K))
Log("Value type: " & GetType(superMap.Get(K))
Next

Here is the point ! Thank you Erel.
The value type is a string and not a map, as I thought.
So I must convert the string into map.
I'll give it a try. I hope to succeed :)
 
Upvote 0
Top