Re: Can we create Array of different kinds of primitives ??
Posted By:
Ori_Kushnir
Posted On:
Tuesday, November 11, 2003 09:32 AM
You could create a structure that contains arrays of the different primitive types:
class MultiArray {
int [] intData;
float [] floatData;
...
...
}
And supports mapping from the global array index to
primitive array indices (array instantiation should be
lazy). If you have 20 instances of, say, 4 types,
you'll need to create 5 arrays (4 for the types and one for
the index mapping) instead of 20, not to mention
savings on casting. Of course, it does add its own
indirection.