Android Question Map with integer keys comes back reordered and with string keys after WriteMap/ReadMap

tonykkkkk

Member
Licensed User
Longtime User
Sub OneForTheForum
Dim btns As Map
btns.Initialize
btns.Put(1, "aaa")
btns.Put(2, "bbb")
Log(btns.Get(1))
Log(btns.Get(2))
File.WriteMap(File.DirInternal, "xxx", btns)
Dim getemback As Map
getemback = File.ReadMap(File.DirInternal, "xxx")
For Each i As Int In getemback .Keys
Log(getemback.Get(i))
Next
For Each i As Int In getemback .Keys
Log(getemback.Get(i & ""))
Next
End Sub

The log shows
aaa
bbb
null
null
bbb
aaa

So there may be a second issue: this is a B4A project and "Map Collection - The most useful collection..." says order should be preserved
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…