Hi,
Is it possible to create a generic list in Basic4Android?..
Existing List class is supporting only items of type object.
It will be useful if we can declare a list of the desired type like int,string etc. before using them.
This will save conversion time to/from object type to actual data type while using list.
Yes we can store any value in list.But suppose when we are adding numbers to list,they will be converted to object before they are stored in list and while retrieving they need to be converted back to appropriate data type from object.
This is what we know as boxing/unboxing.
But in java we have generics to avoid this overhead of conversion.
What i mean is can we declare a generic list so that boxing/unboxing overhead is avoided.
Since B4A code is converted to java byte code while compiling,i hope there will be a way to do this.
Yes we can store any value in list.But suppose when we are adding numbers to list,they will be converted to object before they are stored in list and while retrieving they need to be converted back to appropriate data type from object.
This is what we know as boxing/unboxing.
But in java we have generics to avoid this overhead of conversion.
What i mean is can we declare a generic list so that boxing/unboxing overhead is avoided.
Since B4A code is converted to java byte code while compiling,i hope there will be a way to do this.
I agree Generics would be a step forward. They have been part of VB.Net for quite some time. Personally I wish B4A had stronger type handling in general. Implicit type casting makes me nervous.