Is it a good or bad idea to make setters in java return \"this\"?
public Employee setName(String name){
this.name = name;
return this;
}
It not only breaks the convention of getters/setters, it also breaks the Java 8 method reference framework. MyClass::setMyValue is a BiConsumer, and myInstance::setMyValue is a Consumer. If you have your setter return this, then it's no longer a valid instance of Consumer, but rather a Function, and will cause anything using method references to those setters (assuming they are void methods) to break.