J2ME Dynamic arrays
I need to use an array of objects in my J2Me application that will need to both grow and shrink depending on the number of objects contained within. I have so far re-created the entire array each time a new object is to be added or removed with either one more or one less element - this works but is horrible in terms of eficiency and (i suspect) memory usage.
Is there another way? (I'm stuck using JDK1.5)
Cheers for any advice given! :(happy):
That's about the same way the Java ME core classes (as also Collection classes like ArrayList) do it.
For improving the efficiency, go through the source of (Java SE) java.util.ArrayList -- it doesn't recreate the array on every add/remove.
Thanks db, much appreciated!