commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. Steiger (JIRA)" <>
Subject [jira] [Created] (CSV-188) Returns headers as list
Date Wed, 15 Jun 2016 06:54:09 GMT
M. Steiger created CSV-188:

             Summary: Returns headers as list
                 Key: CSV-188
             Project: Commons CSV
          Issue Type: Improvement
          Components: Parser
    Affects Versions: 1.4
            Reporter: M. Steiger

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}}.

This message was sent by Atlassian JIRA

View raw message