Reading a CSV File Into a 2D String List Using Java

preview_player
Показать описание
Reading a CSV File Into a 2D String List Using Java

Greetings, today I am here with a tutorial on how we can read the contents of a CSV file into a 2D String List using Java. By CSV, I mean a file with the csv format. This does work with .csv files but can also work with other files like .txt or .dat. This can also work with a different delimiter.

Each field of a record/line is going to get its own element in this 2D String List. A record is a collection of fields and a field is a single piece of data in a record. We store 1 record per line in this tutorial.

After we read the data from the file into a 2D String list we can then do what we want with the data, like sorting it or displaying it.

This tutorial is also great for anyone looking to read the contents of a file into a List.

Thanks for watching this tutorial on reading a csv file into a 2D String List.

Reading a CSV File Into a 2D String Array Using Java
Рекомендации по теме
Комментарии
Автор

Very useful tutorial mate, appreciate this simple yet concise vid. Really saved my arse for someone inexperienced and inept in java.

somedrunkbloke
Автор

Max, thanks for this tutorial. Question: How do I extract specific data from this list, e.g., row 3, comma 2?

adeensamuel
Автор

Great explanation. Prob saved one of my finals lol

marianobarbieri
Автор

If help is possible, I have difficulty understanding what the data variable carries here. I know without it, the values string could already print a whole column of data as if we can see all of the data in one category. Values[0] could print the first column, etc. So what does the data variable do? Thanks

jtotherock
visit shbcf.ru