J
Joe Attardi
I have some table model classes that contain String[] objects that
contain the column names. Now, since a String[] is mutable, even if the
String[] is declared final, someone calling getColumnNames() could
change the column names.
Would it be overkill to, in getColumnNames(), return a copy of the
array instead via:
return (String[]) columnNames.clone();
or would that be considered a good practice so that the column names
cannot be changed by ill-mannered code?
Thanks in advance..
contain the column names. Now, since a String[] is mutable, even if the
String[] is declared final, someone calling getColumnNames() could
change the column names.
Would it be overkill to, in getColumnNames(), return a copy of the
array instead via:
return (String[]) columnNames.clone();
or would that be considered a good practice so that the column names
cannot be changed by ill-mannered code?
Thanks in advance..