On Tue, 15 Aug 2017 09:49:04 -0600, Gary Gregory wrote:
That looks odd to me. What comes up for me is the use case where I
want to
ETL a file of 10,000,000 records and update, say, one column. If am
forced
to create a brand new record for every record read, that would be a
shame.
Why?
If I
On Tue, Aug 15, 2017 at 10:38 AM, nitin mahendru wrote:
> How about having a state in the class itself which says that it's mutable
> or not.
> If we call a setter on an immutable then it throws an exception.
> By default the records are immutable and you need to
On Tue, 15 Aug 2017 12:02:20 -0600, Gary Gregory wrote:
On Tue, Aug 15, 2017 at 10:38 AM, nitin mahendru
How about having a state in the class itself which says that it's mutable
or not.
If we call a setter on an immutable then it throws an exception.
By default the records are immutable and you need to make them mutable
using a new API.
pros: Saves memory, Keeps the immutability benefits
cons:
That looks odd to me. What comes up for me is the use case where I want to
ETL a file of 10,000,000 records and update, say, one column. If am forced
to create a brand new record for every record read, that would be a shame.
If I had a mutable record, I could just keep on updating it and using it
On Tue, 15 Aug 2017 08:01:53 -0600, Gary Gregory wrote:
How does that work when you want to change more than one value?
How about a "vararg" argument:
/**
* @param orig Original to be copied.
* @param replace Fields to be replaced.
*/
public static CSVRecord createRecord(CSVRecord orig,
Hi,
I very much like that CSVRecord is unmodifiable. So I’d suggest an API, that
creates a new record instead of mutating the existing one:
CSVRecord newRecord = myRecord.put(1, „value")
I’m not sure about „put“ as a method name since it clashes with
java.util.Map#put, which is mutation
How does that work when you want to change more than one value?
Gary
On Aug 15, 2017 00:17, "Benedikt Ritter" wrote:
> Hi,
>
> I very much like that CSVRecord is unmodifiable. So I’d suggest an API,
> that creates a new record instead of mutating the existing one:
>
>