I have an hashmap containing all my precious objects.
For all operations on this hashmap, I'm using Iterators, one of their powerful tools!
I can remove, add elements quietly, without thinking about keys.
However each object is related to space coordinates (x,y,z) and if I'm storing them in objects, I'm especially making ALL calculations inside a global jitter matrices fed by my JAVA core when I'm creating objects.
Because of this architecture, I had to use specific keys in my hashmap.
The key of an element in the hashmap is related to the row of my triplets in the jitter matrix
element in the hashmap with the key 5 got its coordinates in the 3 planes matrix at the cells (5,0) of each plane.
My totally working way but a bit strange is:
I maintain a current ID in my JAVA Core and as soon as I add an object, I increment it.
When I'm storing the whole objects in my XML, it iterates, put objects parameters in the file.
When I'm loading the XML, no prob even if it wasn't contiguous when I created my objects,
I remove objects ONLY during composition session (= not on stage!) and this creates discontinuities in the
if I can have non contiguous ID in my hashmap (I mean: keys like 1,4,5,6,9,10,14), because the element with key 4 is the second, it obviously is related to the second row of my matrix which isn't good.
what would be your approach for that ?