I have a program working on huge data sets. Objects are best stored in hash containers as the program continues to search for objects in the container.
The first idea was to use HashMap, since the get and remove methods of this container are more suitable for the use I need.
But I came to the conclusion that using HashMap is quite a lot of memory, which is a serious problem, so I thought that switching to a HashSet would be better, because it uses only <E> and not <K,V> for each element, but when I looked at the implementation, I found out that it uses the basic HashMap! this means that it will not save memory!
So these are my questions:
As indicated in the comments, I will expand my program a bit, hashMap is designed to store a couple of other objects, as well as some numerical value calculated on the boards. along the way, he extracts some of them and introduces new pairs. For a couple, it is necessary that she does not hold this pair or remove it. Mapping can be done using a float or hashCode value for a paired object.
Also, when I say "huge datasets", I am talking about objects ~ 4 * 10 ^ 9
java memory-management hashmap hashset hash
Ravid goldenberg
source share