[Mono-list] More fighting with Hashtable
John Barnette
jbarn@httcb.net
Thu, 12 Jul 2001 23:21:42 -0600
Hey kids,
So in my ongoing wrestling match with System.Collections.Hashtable, I've
come up against another implementation wicket, this one regarding increasing
the number of available buckets when threshold is reached. The pertinent
text:
"When the actual load factor reaches the load factor, the number of buckets
in the Hashtable is automatically increased to the smallest prime number
that is larger than twice the current number of Hashtable buckets."
I've got it currently implemented as
int newCapacity = oldCapacity * 2 + 1;
...which works, but I'd rather be specworthy. Can anybody point me at some
math for determining the next prime number greater than a given integer?
~ j. // Oh, how I hate math. ;-)