Memory management HashMap versus ArrayList.

Hopefully this is the right place to post this!

Okay, here is my question. I have been trying to research on the memory hit an application is going to incur if it uses a HashMap instead of an ArrayList and I have not been able to find a satisfactory answer.

Suppose I have say 10,000 objects and the way I access them is such that 50% of time I end up iterating through the whole list, and the other 50% I have to access its entries randomly, then what should I opt for a HashMap or an ArrayList?

The way the data is stored in my HashMap is such that a String is used as a key. So according to me, at the very least not including HashMap抯 internal overhead I am going to waste memory just by creating a String object to represent the 慘ey?and I would be better of using an ArrayList in terms of memory utilization and will not experience a major performance hit.

Does anyone have a take on this?

[927 byte] By [monaPillaia] at [2007-11-27 9:19:44]
# 1
Cross-post http://forum.java.sun.com/thread.jspa?threadID=5190383
aniseeda at 2007-7-12 22:12:16 > top of Java-index,Desktop,Runtime Environment...