Currently I am looking for best replacement of HashMap becuase of memory overhead and I need faster update and retrieval of data.
I don’t know if a
Trie will give you a smaller memory overhead than a
HashMap. It depends on the size and distribution of the keys, and on how you implement the Trie. The same probably goes for speed of lookup and update.
I think you will need to try (no pun intended) both alternatives and measure the performance … with datasets that are representative of your actual data.
The other point (which you seem to have misunderstood) is whether you plan to exploit the Trie-specific methods in the API; e.g.
last, etcetera. If you do, then you need to use a Trie … or some other kind of navigable map API. You can’t do such things efficiently using a
solved PatriciaTrie or HashMap which is best to store large amount of data in session