In Java I'm able to modify final
members in the constructor. Please see the following example
class Scratch {
private final String strMember;
public Scratch(String strParam) {
this.strMember = strParam.trim();
}
}
Is there a way in Kotlin to modify val
members during construction, in this case to trim()
them before the parameter value are assigned to the field.
If not, what is the recommended workaround to do so without generating too much overhead?