org.xwt.util
Class Hash

java.lang.Object
  extended byorg.xwt.util.Hash
Direct Known Subclasses:
Cache

public class Hash
extends java.lang.Object

Implementation of an unsynchronized hash table, with one or two keys, using Radke's quadradic residue linear probing instead of buckets to minimize object count (less allocations, faster GC). See C. Radke, Communications of the ACM, 1970, 103-105


Constructor Summary
Hash()
           
Hash(int initialcapacity, int loadFactor)
           
 
Method Summary
 void clear()
          empties the table
 java.lang.Object get(java.lang.Object k1)
           
 java.lang.Object get(java.lang.Object k1, java.lang.Object k2)
           
 java.lang.Object[] keys()
          returns all the primary keys in the table
 void put(java.lang.Object k1, java.lang.Object v)
           
 void put(java.lang.Object k1, java.lang.Object k2, java.lang.Object v)
           
 void remove(java.lang.Object k1)
           
 void remove(java.lang.Object k1, java.lang.Object k2)
           
 int size()
          the number of entries with a non-null value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hash

public Hash()

Hash

public Hash(int initialcapacity,
            int loadFactor)
Method Detail

size

public int size()
the number of entries with a non-null value


clear

public void clear()
empties the table


keys

public java.lang.Object[] keys()
returns all the primary keys in the table


remove

public void remove(java.lang.Object k1)

remove

public void remove(java.lang.Object k1,
                   java.lang.Object k2)

get

public java.lang.Object get(java.lang.Object k1)

get

public java.lang.Object get(java.lang.Object k1,
                            java.lang.Object k2)

put

public void put(java.lang.Object k1,
                java.lang.Object v)

put

public void put(java.lang.Object k1,
                java.lang.Object k2,
                java.lang.Object v)