10
if (<some test>) {
return someObject;
} else {
return someOtherObject;
}
replace with:
if (<some test>) {
return someObject;
}
return someOtherObject;
or for even more brevity and if the line isn't too long (ie you aren't creating the objects in-line):
return <some test> ? someObject : someOtherObject;
Guiding principles/patterns: