Finding Unique Words in a Document
Background
“At the Mountains of Madness” is a fantasy horror novella written by the American author H.P. Lovecraft in 1931. The copyright for the novella has expired and is now in the public domain. We will use this text as input to process and will print a unique list of all the words in the document sorted in alphabetical order.
Assignment Download the Lab12.zip starter file. Use 7zip to unzip the file using ‘Extract Here’. Open the project folder in IntelliJ.
In the UniqueWords class, you will implement the processDocument() method that will read in the document one line at a time. For each String that is input, the code will break the String (if the String is not null or empty) into individual words (using the supplied tokenize() method). The code will then store the word into an appropriate Collection object (a sub-class of Set) that will store unique words in sorted order. The processDocument() method will return the collection.
Notes:
- The returned list of words must be unique – no word may appear more than once.
- The list of words must be sorted in alphabetic order.
- The selection of the right Collection type will automatically guarantee that the list is both sorted and unique. You will not add any special code beyond choosing the correct Collection type to handle sorting and uniqueness.
Example Output
a
abandoned
abandonment
abdul
abhor
abhorred
abhorrent
. . .many lines of output omitted. . .
you
young
younger
zeal
zenith
zero
ziggurats
Got 6099 words

We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.