I have JRDC-Like Project thet return me a K-Val data (listOfMaps) from SQL database for fill my CustumControl (controlsfx SearchableComboBox)
The problem is with SetSelectingID and "KValMap" thhet has Key as Object
IF the database return key=10 "as long" and I try to "SetSelectedID" "as Int" nothing happend, if same "key as Long" all ok!
Private Sub Class_Globals
Private KValMap as Map
Private ComboboxJO as JavaObject
end sub
Public Sub Fill_CB(ListOFMaps as List)
KValMap.Initialize
Dim Items as List=ComboboxJO.RunMethod("getItems",Null)
For Each ItemMap As Map In ListOFMaps
Items.Add(ItemMap.GetValueAt(1))
KValMap.Put(ItemMap.GetValueAt(0),ItemMap.GetValueAt(1))
Next
end sub
Public Sub SetSelectedID(ID As Object)
If KValMap.ContainsKey(ID) Then SetSelectedItem(KValMap.Get(ID))
End Sub
Public Sub SetSelectedItem(Item As Object)
ComboboxJO.RunMethodjo("getSelectionModel",Null).RunMethod("select",Array(Item))
End Sub
In my case "ID", can be: String, Long, Int, Float (Not in the same time!), and I Use "Object" for it
I'm try small example
Dim Longkey As Long =10
Dim IntKey As Int =10
Dim m As Map=CreateMap(10:0)
If m.ContainsKey(Longkey) Then LogDebug("Longkey")
If m.ContainsKey(IntKey) Then LogDebug("IntKey")
And result only "IntKey"
10 "as Int" <> 10 "as Long"?
Sorry for my english