Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Arrays vs HashMap

807603Feb 28 2008 — edited Feb 28 2008
I have a program that I'm writing that requires a very large array. This presents a problem b/c as my data input grows I will run out of heap space because of the large amount of contiguous memory I'm asking for in my array. I thought, why not use a hashmap mapping from integer to object. The hashmap could function like an array in that it would have nearly constant lookup and it wouldn't have contiguous memory so I could store more data. Is that true or am i crazy?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2008
Added on Feb 28 2008
1 comment
222 views