Well, not really the place to ask, but I thought I'd start here, since it's not as if SCP can't lay claim to some pretty competent programmers of its own
I'm toying around with something in Java, and trying to get my head around something. Say I've created a Class called TradeItem, which is stored as a Vector in Java. Now, say that I have also created a HashMap, which references TradeItems and stores a list of other objects, e.g:
ArrayList<TradeItem> allItems = null;
HashMap<TradeItem, ArrayList<Market>> m = new HashMap<TradeItem, ArrayList<Market>>();
So, obviously, this Map allows the system to look up which markets sell which items. Now, supposing I were to save these to disc using the ObjectStream function as two seperate
files, reset the JVM and load them back into the system the same way. What does my memory now contain? From what I recall, HashMap uses the HashCode of the key to generate a position to store the data, but that would, as far as I can tell, rely on the data always being in the same place in memory, which may not be the case after a reset? And if that is not the case, does the system keep two copies of the TradeItem list on reload? Which is something I want to avoid.
I'm assuming the system will cope as long as the List is loaded first, which is automatically cross referenced somehow with the Map once it is loaded, but if someone can understand this and point me in the right direction, I'd appreciate it, I think I've thought about it
too hard the last few hours...