commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <>
Subject [CSV] Some tweaks for working with headers
Date Sun, 01 May 2016 19:05:27 GMT

I often seeing myself doing the following when my csv file has a header row:

   .withHeader() // use first row as header

How about combining the two into a method called withFirstRecordAsHeader()
or something like that?

Further more I find it unsymmetrical that I can retrieve a column value
from CSVRecord using an enum, but I cannot pass an enum to CSVFormat to
define a header. So I'd like to add a new overload of withHeader:

withHeader(Class<? extends Enum> headers)

The method would iterate over the enum values defined by the class and use
the name() method on each value for defining the header. This way I can
define an enum for my headers, use it when specifying the format and when
retrieving values from the records.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message