public class StringHash { Node[] buckets; private static int BUCKETS; private static final char MULT = 31; private class Node { String data; Node next; private Node(String word) { data = word; next = null; } } public StringHash(int numBuckets) { } public static int hashValue(String s) { int h; int x, l = s.length(); h = 0; for ( x =0; x < l; x++ ) h = h * MULT + s.charAt(x); if ( h < 0 ) h = -h; return (h % BUCKETS); } void add(String word) { } boolean hasWord(String word) { } public void dumphash() { int x; Node p; for (x = 0; x < BUCKETS; x++ ) if ( buckets[x] != null) { System.out.printf("\n\nBucket #%d\n", x); p = buckets[x]; while ( p != null ) { System.out.print(p.data + " "); p = p.next; } } } }