I have a problem with Map
The following is part of the code:
where instMap and insteonDev are declared as follows:
The list items are not added to the map as the log show:
Any idea what am I doing wrong?
The following is part of the code:
B4X:
Log("List1 " & list1)
Log("List2 " & list2)
instMap.Initialize
For i = 0 To list1.Size-1
insteonDev.Initialize
insteonDev.Name = list2.Get(i)
insteonDev.Address = list1.Get(i)
instMap.Put(insteonDev.Name, insteonDev)
Log(i & insteonDev )
Next
Log("instMap " & instMap)
where instMap and insteonDev are declared as follows:
B4X:
Type InsteonDevList ( _
Name As String, _
Address As String)
Dim insteonDev As InsteonDevList
Dim instMap As Map
The list items are not added to the map as the log show:
B4X:
List1 (ArrayList) [1FEFCD, 1FEFAF, 1FEF4B, 1FEF65, 1FEF66, 1FEF57, 1FF40C, 1C4B5A, 1C4AB5, 1C4B53, 14B35A]
List2 (ArrayList) [SW1, SW2, SW3, SW4, SW5, SW6, MOT1, REM1, REM2, REM3, SEN1]
0[Address=1FEFCD, IsInitialized=true, Name=SW1]
1[Address=1FEFAF, IsInitialized=true, Name=SW2]
2[Address=1FEF4B, IsInitialized=true, Name=SW3]
3[Address=1FEF65, IsInitialized=true, Name=SW4]
4[Address=1FEF66, IsInitialized=true, Name=SW5]
5[Address=1FEF57, IsInitialized=true, Name=SW6]
6[Address=1FF40C, IsInitialized=true, Name=MOT1]
7[Address=1C4B5A, IsInitialized=true, Name=REM1]
8[Address=1C4AB5, IsInitialized=true, Name=REM2]
9[Address=1C4B53, IsInitialized=true, Name=REM3]
10[Address=14B35A, IsInitialized=true, Name=SEN1]
instMap (MyMap) {SW1=[Address=14B35A, IsInitialized=true, Name=SEN1
], SW2=[Address=14B35A, IsInitialized=true, Name=SEN1
], SW3=[Address=14B35A, IsInitialized=true, Name=SEN1
], SW4=[Address=14B35A, IsInitialized=true, Name=SEN1
], SW5=[Address=14B35A, IsInitialized=true, Name=SEN1
], SW6=[Address=14B35A, IsInitialized=true, Name=SEN1
], MOT1=[Address=14B35A, IsInitialized=true, Name=SEN1
], REM1=[Address=14B35A, IsInitialized=true, Name=SEN1
], REM2=[Address=14B35A, IsInitialized=true, Name=SEN1
], REM3=[Address=14B35A, IsInitialized=true, Name=SEN1
], SEN1=[Address=14B35A, IsInitialized=true, Name=SEN1
]}
Any idea what am I doing wrong?