Map problem

ukimiku

Active Member
Licensed User
Longtime User
I am trying to put into a map a key/value pair for which the key is of type string and the value is of type Big Integer (from the Big Numbers library v.1.00):
B4X:
dim m as map
dim bi as BigInteger

m.Initialize
m.clear
bi.Initialize("12")

m.put("3", bi)

Android complains at runtime: "Object should first be initialized: Big Integer". But obviously, bi has been initialized (the debugger confirms this). The documentation for "map" says that the value in the key/value pair can be any object. A Big Integer is an object. What do I need to do in order to make it work?

Thank you.
Regards,
 

mc73

Well-Known Member
Licensed User
Longtime User
Don't know why this is happening, but you can try putting bi.toString alternatively.
 
Upvote 0

ukimiku

Active Member
Licensed User
Longtime User
Thanks for confirming.

To me, this seems to be a bug, but I can't say whether it's in the map routines or in the Big Integers library. I have, for now, resorted to putting the string representation of the big integer into the map (just as you suggested), but that's also a performance penalty since I am invoking "ToString" quite a number of times.

Regards,
 
Upvote 0

ukimiku

Active Member
Licensed User
Longtime User
Erel, could you please take a look at the code above and comment on the problem? Is it a map bug? Related to Big Integers? Thank you.

Regards,
 
Upvote 0

ukimiku

Active Member
Licensed User
Longtime User
Thank you.

Regards,
 
Upvote 0
Top