(new File("/classes/s09/cs225/words.txt")) Īnd that a file can be processed, token by token, in a loop such as: You can create scanner, filein, for reading from a file with a statement such as: Since there is no need to have the words stored in order, you can use a HashSet for maximum efficiency. ![]() To make the list easy to use, you can store the words in a set. You will look up words in this list to check whether they are correctly spelled. The file words.txt (in the code directory) contains a list of English words, with one word on each line. You will also need to be able to traverse a set, using either an iterator or a for-each loop. set.isEmpty() - Check whether the set is empty. ![]()
0 Comments
Leave a Reply. |