For example:
I'm creating a CSV file and I have a CsvOptions object which holds several parameters for the CSV file creation.
if (cells.hasNext()) {
output.write(csvOptions.getDelimiter());
}
The csvOptions is just a simple container object, that kind you are tempted to not use any getters at all. The getter just returns the value from a private field.
Is it worth to cache the return value of a trivial getter, like getDelimiter() in my example, in terms of
- ... execution speed?
- ... coding style?