Android Question Can a map hold arrays of different types?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
To do with code to sort the flexible table I had a map holding 1D arrays of different types (int, double and string).
The map key was holding the table column number and the map value these 1D array. These 1D arrays would then
be passed to a quicksort, producing an integer, 1D index array, so the arrays were not changing. It was working, but
there were strange intermittent errors (so really it wasn't working) cause wrong results and a null exception message in the log.
Strangely, these errors didn't crash the application. Because of these errors I changed it to 3 (int, double and string) different
2D arrays, to be passed to the quicksort with the array column number. With that all is working fine.
My question is if it is OK to use a map holding arrays of different datatypes. To me it seems it isn't.

RBS
 

DonManfred

Expert
Licensed User
Longtime User
You can use a Map for any Data as long as you don´t need to save_/load the data from the Map.
I suggest to watch the Collections Tutorial Video.

Using b4xSerializator your can save/load a Map too.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…