Can anyone show me how to build a hashtable to test for some string values to see how they would hash into a table. It's late and I may not be to asking this just right.I want to make a test hashtable, insert some words and see where they are put in the table. would like the size of the table to be 101, but everytime I try to call what I've done I get an error saying I can't use [] to find the position. I can give you what I have for code but it's far from finished I fear.
If you can be of any help I thank you. Ron
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
I guess you are more used to C++/STL than Java, as the program above has a lot of other conversion issues too. In Java, a variable is just a reference, so you always need to initialize them before use. T is declared as a reference to a Hashtable, for example, but nowhere does it say T = new Hashtable(), so T is always null. Likewise for M which is never initialized and so remains at 0 (it may look as if it is initialized in one of the constructors, but that actually just assigns a value to a local variable which is then discarded).
I want to thank you both, I am just getting started at this and I know there are a lot of problems with the code. Is there a way to write a hashtable without using Java's Hashtable class to solve the problem above?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.