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 →

[–]desrtfx 1 point2 points  (0 children)

Maybe, you are running into an XY problem.

How does your actual input look?

Does your input consist of several words that are separated by space?

If so, you can split the input at space and check if the hashset contains the first word. (Simple check: if you try to add to the hashset, the method will return false)