|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.utils.PrimeFinder
public final class PrimeFinder
Used to keep hash table capacities prime numbers. Not of interest for users; only for implementors of hashtables.
Choosing prime numbers as hash table capacities is a good idea to keep them working fast, particularly under hash table expansions.
Field Summary | |
---|---|
static int |
largestPrime
The largest prime this class can generate; currently equal to Integer.MAX_VALUE. |
Constructor Summary | |
---|---|
PrimeFinder()
|
Method Summary | |
---|---|
static int |
nextPrime(int desiredCapacity)
Returns a prime number which is >= desiredCapacity and
very close to desiredCapacity (within 11% if
desiredCapacity >= 1000 ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int largestPrime
Constructor Detail |
---|
public PrimeFinder()
Method Detail |
---|
public static final int nextPrime(int desiredCapacity)
>= desiredCapacity
and
very close to desiredCapacity
(within 11% if
desiredCapacity >= 1000
).
desiredCapacity
- the capacity desired by the user.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |