Search code examples
cachinghashmemcachedb-treemapdb

hashmap vs treemap in mapdb: how to compare them?


Recently I started playing with MapDB, and learning about its interesting properties. As I understand now, it has three major data types: BTree, Hashmap and Hashset. Something which is a little obscure to me is that, when it is better to use Hahsmap (and Hashset), than using Btree? Any pros and cons in using each data structure compared to the other?


Solution

  • In 1.0 HashMap is better for larger keys, it also has entry expiration based on TTL or maximal size. TreeMap is sorted and has data pump.

    I would recommend HashMap in general.