On Sep 2, 2014, at 11:43 AM, Jacques Le Roux <[email protected]> wrote: > > I don't see a need to make those finals. They are cached and cost at maximum > hundreds of bytes. > Having them cached allows to dynamically change them, which can be handy > sometimes (general remark for other possible cases) > > Jacques
These fields were not modifiable even before my changes; the final keyword I have added didn't change the external behavior of them. However in general, if some field can change and the class can be used by different threads then you have to make sure the class is thread safe (and this is expensive): this is the main advantage of having (when possible) immutable classes, they are thread safe at no cost. This is not a matter of memory usage. Jacopo
