This works with descriptor as a type, it should be the same with any object or class.
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Type Descriptor(Segment As Int)
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Dim Sg(10) As Descriptor
Dim Segptr As Int = 0
Sg(Segptr).initialize
Sg(Segptr).Segment = 1
End Sub
I tried that before as a workaround, the main reason why I was after a map is the analysis of those in the code. With the TYPE solution I have to implement another method to do so. Not a big deal, but not nice as it breaks a little the concept of the code
If you use a Map it's contents could be an object of any type, you will have to read and assign an object to a variable of the correct type from the map before you can assign values to it's properties.
In an Array all it's elements have the type that you gave the array so you can access each elements properties directly.