Monday, June 23, 2014

[电面基础]: Java基于Hashtable的问题讨论 哈希表 Continued


很多同学都对于上一期我们post的HashMap的讲解很感兴趣,我们只是cover了最基本的问题,事实上Java 8对于HashMap的性能做了一定程度的提高。

http://www.nurkiewicz.com/2014/04/hashmap-performance-improvements-in.html?m=1

这是一篇非常好的Blog简洁的介绍了Java 8对于HashMap的提高,

Key take aways

  1. When collision happens, instead of using a LinkedList, a Tree is used to cut of the search time from O(N) to O(lgN)
  2. Reducing the collision costs will also prevent DOS in a way so that attackers can not send lots of hash-collision requests to slow down the servers. 



No comments:

Post a Comment

Thank your for your comment! Check out us at https://baozitraining.org/ if you need mock interviews!