Check out example codes for "apache csv get headers". It will help you in understanding the concepts better.

Code Example 1

CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader(FILE_HEADER_MAPPING);
FileReader fileReader = new FileReader("file");
CSVParser csvFileParser = new CSVParser(fileReader, csvFileFormat);
List csvRecords = csvFileParser.getRecords();

Learn ReactJs, React Native from akashmittal.com