SethFalco opened a new pull request, #309:
URL: https://github.com/apache/commons-csv/pull/309

   A while back we discussed duplicate header behavior, and in the comments 
thought we should define what happens when one tries to get from a 
`CSVRecord`/`Map<String, String>` when this occurs.
   
   Relevant comments:
   * https://github.com/apache/commons-csv/pull/114#issuecomment-874321915
   * https://github.com/apache/commons-csv/pull/114#issuecomment-876858602
   
   I reviewed the code and manually tested to discover the current behavior:
   
   * Adds two test cases that reinforce the current behavior.
   * Updates the docstrings of `CSVRecord#get` and `CSVRecord#toMap` to state 
how this is handled.
   
   ---
   
   It may be that instead of this, we may want to instead define a different 
behavior before we add documentation and tests to cover this case.
   
   I'm honestly not sure what the expected behavior would be for this. I'm 
tempted to say that it should throw an exception in this instance. :thinking:
   
   I'm not aware of the use-case for having duplicate headings in the first 
place, but I assume there is a reason for it. But I definitely don't see why 
one would use methods like `#get` or `#toMap` in cases that they know they have 
duplicate headers.
   
   Maybe if the first and last index of the given header name differs, throw an 
exception?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to