It's a simple problem for parsing records.
You don't want each line in a List
; you want the POJO containing the data after you tokenize each line.
Here's pseudo-code:
- Open file
- Loop over all lines in file
- Tokenize each line and populate POJO
- Add POJO to List
- Close file
- Perform any operations you wish on POJOs
- Output POJO List in desired format
If it's just tab delimited, perhaps you can use a library that already deals with .csv files.