Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.4
-
None
-
None
Description
I suggest adding a new method to CSVParser that returns a list of headers. My use case is to create a new CSVPrinter from it that uses different formatting rules.
My current implementation looks like this:
Map<String, Integer> headers = parser.getHeaderMap(); String[] array = new String[headers.size()]; for (Entry<String, Integer> entry : headers.entrySet()) { array[entry.getValue()] = entry.getKey(); } CSVFormat outFormat = CSVFormat.newFormat('|').withHeader(array);
This would become a lot simpler, if I could get the (unmodifiable) list directly from CSVParser.