0

In relation to my question - List Map data in excel using java, is there a way where I can convert the code to read csv file with same output as a result

This is the sample csv data:

enter image description here

My expected Output would be like this: enter image description here

Thank you!

TesterMan
  • 31
  • 1

1 Answers1

0

No Map involved here, just a List.

You have not explained the semantics. But it appears that you simply need to define a Person class (or a Person record in modern Java) with five properties named in first row.

Read your CSV row by row, constructing a Person object for each row. I suggest using a library to help with the CSV parsing, such as Apache Commons CSV. Add each new Person object to a List such as ArrayList.

Call toString on your List to generate output text. If you want a different format, loop the Person objects in the list to generate your own text of desired format.

All of this has been covered many many times already on Stack Overflow. So search to learn more.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154