commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <>
Subject Re: [CSV] Records as Lists
Date Tue, 18 Dec 2018 12:28:03 GMT

On Tue, 18 Dec 2018 07:22:00 +0000 (UTC), Bruno P. Kinoshita wrote:
> From what I understood from the previous messages & discussion on
> GitHub, it would be more convenient for users to be able to have a
> List instead of an Iterable,

Why "instead"?
The patch makes the class a subclass of "List"; and "List"
implements "Iterable".

> or instead of having to call the
> #toList() or convert to a List in some other way.
> I commented in the pull request, that I don't think there would be a
> performance penalty in doing so (at least I don't think so, as the
> values are not streamed, but rather kept in the private values 
> array).
> However, I think we are delivering an Iterable that's fully capable
> to be used as an Iterable now. Whereas the proposal would make it a
> read-only list, as that returned from unmodifiableList,

That's not what the patch does:

> i.e. throwing
> exceptions for add/clear/etc operations.

The original code (using "Arrays.asList") could not do those 

> In my opinion, I prefer to keep it as an Iterable, leave the toList
> method, as I think current users could be affected

[In the original code, "toList" is private.]

> by accidentally
> trying to reuse CSVRecord while reading from one input and writing to
> an output stream.

I don't understand this.


> So I'm -0 for it.
> Bruno
>       From: sebb <>
>  To: Commons Developers List <>
>  Sent: Tuesday, 18 December 2018 12:24 AM
>  Subject: Re: [CSV] Records as Lists
> What is the use-case for using lists?
> On Thu, 13 Dec 2018 at 18:34, Gary Gregory <> 
> wrote:
>> Hi All,
>> I am looking for opinions on turning a CSV record into a list, as 
>> opposed
>> to the minimal current implementation. There would be side-effects 
>> like a
>> record becoming writable instead of read-only as the current 
>> implementation.
>> Memory footprint would also be a concern.
>> Please see
>> Gary
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message