[
https://issues.apache.org/jira/browse/CSV-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
M. Steiger closed CSV-188.
--------------------------
Resolution: Fixed
Thanks!
> Returns headers as list
> -----------------------
>
> Key: CSV-188
> URL: https://issues.apache.org/jira/browse/CSV-188
> Project: Commons CSV
> Issue Type: Improvement
> Components: Parser
> Affects Versions: 1.4
> Reporter: M. Steiger
> Priority: Major
>
> 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:
> {code}
> 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);
> {code}
> This would become a lot simpler, if I could get the (unmodifiable) list
> directly from {{CSVParser}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)