6、了,几乎是O(n/2)级别的,但是我没有说出来再哈希的过程,以及哈希值相同时到底如何存放,所以……~~o(>_<)o~~)。为了说明HashSet在Java中确实如上实现,下面附上JDK中两个重要方法的源码:(下面源码来自于HashMap,原因是HashSet是基于HashMap实现的)viewplainprint?1./** 1. * Rehashes the contents of this map into a new array with a 2. * larger capacity. This method is called
7、automatically when the 3. * number of keys in this map reaches its threshold. 4. * 5. * If current capacity is MAXIMUM_CAPACITY, this method does not 6. * resize the map, but sets threshold to Integer.MAX_VALUE. 7. * This has the effect of preventing future cal