Afternoon, I’m trying to implement a hashtable in Java, using K mod 13 as the hash function. Does anyone know of any resources to learn about hashtables? I’ve been searching on Google, and several forums for hours (maybe I’m doing it wrong).
I received an incredibly abstract lesson on Hashtables on Friday, describing collisions, overflow etc. but absolutely NOTHING on implementation. Since the assignment is on Hashtables, I cannot use Hashmaps, as several people have reccommended, and condemned me for not doing.
So far, this is all I can come up with as sad as it may be.
private Hashtable <String, String> ht = new Hashtable <String,String>(20);
In order to solve the problem I’ve been assigned, I need to use a hashtable of integers, but Java isn’t allowing this…do you know why?
Both of the following code segments are invalid:
private Hashtable <Int, Int> ht = new Hashtable <Int, Int>(20);
private Hashtable <int, int> ht = new Hashtable <int, int>(20);
I’d greatly appreciate some assistance to steer me in the right direction, all attempts to seek assistance from colleagues has resulted in less than favourable outcomes.
I apologize for my lack of knowledge on the subject,
Thanks.
Keys and values of a Hashtable must be objects, not primitives.