I have a text file with a word or phrase on each line. How do I:
- Read those phrases into memory,
- Make distinct (eliminate duplicates),
- Sort alphabetically,
- Write the results back out to a file?
StackOverflow has answers for similar Questions in other languages such as C, PHP, Python, Prolog, and VB6. But I cannot find one for Java.
You can leverage:
…to solve the problem elegantly:
Note: requires static imports