A
andreyvul
Should set methods for private final fields be declared final or not?
I.e. is this correct:
public class foo {
private final bar baz;
public foo(bar q) {
baz = q;
}
public final bar getBaz() {
return baz;
}
}
or should it be
public class foo {
private final bar baz;
public foo(bar q) {
baz = q;
}
public bar getBaz() {
return baz;
}
}
?
Which is better, factoring in speed, maintainability, ease of coding/
debugging, size, etc.?
I.e. is this correct:
public class foo {
private final bar baz;
public foo(bar q) {
baz = q;
}
public final bar getBaz() {
return baz;
}
}
or should it be
public class foo {
private final bar baz;
public foo(bar q) {
baz = q;
}
public bar getBaz() {
return baz;
}
}
?
Which is better, factoring in speed, maintainability, ease of coding/
debugging, size, etc.?