Sorting a text file in Java

file, java, sorting, text

Solution

This is a simple four step process, with three of the four steps addressed by Stackoverflow Questions:

- Read each line and turn them into Java String

- Store each Java String in a Array (don't think you need a reference for this one.)

- Sort your Array

- Write out each Java String in your array

Problem

I have a text file with a list of words which I need to sort in alphabetical order using Java. The words are located on seperate lines. How would I go about this, Read them into an array list and then sort that??

Original source

Related problems