I'm wondering if there is an implementation of a map which is:
In short, is there a functional data structure that can compare with Hash Maps in performance?
The answer is NO. Making keys in any hashing data structure will cause memory leak. If we make the keys mutable then the hashcode() of the key will no more be consistent over time which will cause lookup failure for that object from the data structure. Let's analyze this example.
You can simply create a new HashMap from the existing Map using the copy constructor. HashMap<String, Object> = new HashMap<>(immutableMap);
Clojure has immutable maps. (link). Not sure what underlying data structure it is using. Clojure source code will give you more information!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With