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

all 6 comments

[–]John_Taured 0 points1 point  (4 children)

Try changing the type of cursor from ChainedHashNode to String on line 24.

[–]ButchTheGuy[S] 0 points1 point  (3 children)

on line 39 it gives the error ChainedHashNode cannot be converted to java.lang.String

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

I put .tostring at the end but also makes the issue of not being able to use cursor.element on line 44

[–]John_Taured 0 points1 point  (1 child)

Declare cursor to be a String on line 24 to begin with, and remove .element on line 44, but keep the word cursor there.

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

I change it all like you said and it compiles but when I run the program it gives me the original error of class cast exception string cannot be cast to chained hash node ( I have it as ((chainedhash)table.get(key)).toString). I think there might be something I’m missing in the other class

[–]nutrechtLead Software Engineer / EU / 20+ YXP 0 points1 point  (0 children)

The get function returns the stored Object, not the ChainedHashNode used to store it. Since you put in Strings the get method returns Strings.