Which do you prefer and why?
public void setPresenter(Presenter presenter) {
this.presenter = presenter;
}
public void setPresenter(Presenter p) {
presenter = p;
}
I prefer the this
-notation, at least in constructors, and compound setter methods, where you have multiple arguments.
In the particular case of a setter, I don't really have an opinion, since the method name is explanatory enough, and the implementation is a single assignment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With