Hello!
What I want to do:
I have many object all with their own “depth” value. This value determines WHEN this object is drawn on the screen ( so that objects farther away don’t overlap object that are supposed to be infront of them ).
I tried using an ArrayList at first. Inserting with arrayList.add(obj, obj.depth()); thinking it would sort the objects based on their depth. But it didn’t sort them at all.
Then I tried using a Map, it worked except for one huge detail… I couldn’t have multiple objects with the same depth. So lots of objects didn’t get drawn on the screen at all.
Then I tried using this TreeMap class that implements a SortedMap interface - it sounded promising, however, the same problem occured as with the Map, I was unable to store multiple object with the same depth in the map.
the depth of these objects is an integer value. If that helps, I’m at a loss on how to accomplish this, any ideas?
Thanks,
Jon