Hi,
I was wondering which is better style to return a parameter from a method:
1.
if (someBooleanIsTrue)
{
someTypeList = getTypeInstance(param1, param2);
}
else if (anotherBooleanIsTrue)
{
someTypeList = getTypeInstanceSecondMethod(param1, param2);
}
return someTypeList;
2.
List<SomeType> someTypeList = null;
...
if (someBooleanIsTrue)
{
return getTypeInstance(param1, param2);
}
else if (anotherBooleanIsTrue)
{
return getTypeInstanceSecondMethod(param1, param2);
}
return new ArrayList<SomeType>();
Which option do you like better and why? Please have arguments :)
Cheers