A HashSet is probably the correct answer, but if you choose (for simplicity, for example) to search for a list, it is probably more efficient to combine your words into String with delimiters:
String wordList = "$word1$word2$word3$word4$...";
Then create a search argument with your word between the delimiters:
String searchArg = "$" + searchWord + "$";
Then do a search, say contains:
bool wordFound = wordList.contains(searchArg);
Perhaps you can make this a bit more efficient by using StringBuilder to create a searchArg.
source
share