com.lmonson.hash.cuckoo
Class Cuckoo<T>

java.lang.Object
  extended by com.lmonson.hash.cuckoo.Cuckoo<T>

public class Cuckoo<T>
extends java.lang.Object

An implementation of a Cuckoo Hashtable.

Creating a Cuckoo hash table

 Cuckoo c = new Cuckoo();     // Create the hashtable
 c.add(1);                    // add an Integer to the hashtable
 c.add("blah");               // add a string to the hashtable
 c.contains(1);               // returns true
 c.contains(2);               // returns false
 

Limiting the hash table to a single data type

 Cuckoo<String> c = new Cuckoo<String>();     // Create the hashtable
 c.add(1);                    // compilation error
 c.add("blah");               // add a string to the hashtable
 

Supplying your own hash functions

 HashFunction myHash1 = ...
 HashFunction myHash2 = ...
 Cuckoo c = new Cuckoo(myHash1, myHash2);     // Create the hashtable
 


Constructor Summary
Cuckoo()
           
Cuckoo(HashFunction h1, HashFunction h2)
           
 
Method Summary
 void add(T t)
           
 boolean contains(T t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cuckoo

public Cuckoo()

Cuckoo

public Cuckoo(HashFunction h1,
              HashFunction h2)
Method Detail

contains

public boolean contains(T t)

add

public void add(T t)