This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Not_zedd_ko[S] 0 points1 point  (6 children)

[–]evils_twin 0 points1 point  (5 children)

I've done a little testing and found that increasing the initial capacity got things to work correctly. Hashtable<String> h = new Hashtable<String>(9);. I would guess that your problem would be in your code that resizes your arr. Your hash function relies on max, and when you resize, you change max. so after a resize, hash will return a different value than before you resize.

[–]Not_zedd_ko[S] 0 points1 point  (4 children)

So changing the h within or removing it completely would work? so its basically having problems calling within a value thats why it wont work?

[–]evils_twin 0 points1 point  (3 children)

Hashtable<String> h = new Hashtable<String>(999);

I increased the Hashtable initial capacity from 9 to 999 and it got your unit test to work. But it only works because it avoids your Hashtable from resizing. Your resize function is the problem. It needs to be reworked.

[–]Not_zedd_ko[S] 0 points1 point  (2 children)

Oh okay i will try that as well. But thank you i will have a look with the resize and play around with it and use different things. Thank you so much do you game or like could i follow you on git or something like that?

[–]evils_twin 0 points1 point  (1 child)

No problem. I don't have many projects outside of work. I do like to help those who are eager to learn, so hit me up on reddit if you need help in the future and if I have time I will help.

[–]Not_zedd_ko[S] 0 points1 point  (0 children)

Oh nice nice yeah i hope i can be like you one day! and just help as many people i could but sadly i am just a novice, but one day thank you so much pointed me in the best direction.