M Mike1970 Well-Known Member Licensed User Mar 12, 2020 #1 Hi in B4i how can I copy a map into another? Given the fact the function "GetKeyAt" and "GetValueAt" doens't exists? Thanks!
Hi in B4i how can I copy a map into another? Given the fact the function "GetKeyAt" and "GetValueAt" doens't exists? Thanks!
Andrew (Digitwell) Active Member Licensed User Mar 12, 2020 #2 Have you tried B4X: for each ky as object in map1.keys map2.put(ky,map1.get(ky)) next
M Mike1970 Well-Known Member Licensed User Mar 12, 2020 #3 Andrew (Digitwell) said: Have you tried B4X: for each ky as object in map1.keys map2.put(ky,map1.get(ky)) next Click to expand... maybe not uh Later i will try it !
Andrew (Digitwell) said: Have you tried B4X: for each ky as object in map1.keys map2.put(ky,map1.get(ky)) next Click to expand... maybe not uh Later i will try it !
Erel Administrator Staff member Licensed User Mar 12, 2020 #4 The correct answer was posted above. For completeness, here is another option: B4X: Sub CopyObject(o As Object) As Object Dim s As B4XSerializator Return s.ConvertBytesToObject(s.ConvertObjectToBytes(o)) End Sub It will work as long as the keys and values are types supported by B4XSerializator.
The correct answer was posted above. For completeness, here is another option: B4X: Sub CopyObject(o As Object) As Object Dim s As B4XSerializator Return s.ConvertBytesToObject(s.ConvertObjectToBytes(o)) End Sub It will work as long as the keys and values are types supported by B4XSerializator.