What is the difference in Hash Map of Java 7 and Java 8 when both works on constant complexity algorithm? As per my understanding hash map searches in constant time by generating a hash key for an object through hash function.
In Java 7 after calculating hash from hash function if more then one element has same hash than they are searched by linear search so it's complexity is (n). In Java 8 that search is performed by binary search so the complexity will become log(n). So, this concept is wrong that hash map searches an object in constant complexity because it is not the case at all times.
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