Use a file reader and read it line by line, break spaces and add any column to the list. Use BufferedReader to capture lines as follows:
BufferedReader br = new BufferedReader(new FileReader("C:\\readFile.txt"));
Then you can do to capture the line:
String line = br.readLine();
Finally, you can split a row into an array by column by doing the following:
String[] columns = line.split(" ");
Then you can access the columns and add them to the list depending on whether you want to use column 0, 1 or 2.
source share