roy_sanu
asked on
Streamlining the if condition
Hi,
I have a Piece of code with lot of if condition complexity and some more. Here is the sample one
My Approach would be like this below, can some body pls verify is this correct way to do that instead the above one
I have a Piece of code with lot of if condition complexity and some more. Here is the sample one
if(isEnable("xxxxx")){
if(isEnable("yyyyy")){
if("zzzz".equalsIgnoreCase(tttt)){
enableFlag("QuestionUserRole");
xxxxxUserRole=new SAXQuestionUserRole();
}
}
else if("useryyyyy".equalsIgnoreCase(tttt)) {
enableFlag("yyyyy");
useryyyyy = new LinkedHashSet<SAXQuestionUserRole>();
}
My Approach would be like this below, can some body pls verify is this correct way to do that instead the above one
if(isEnable("xxxxx")) && (isEnable("yyyyy")) && (("zzzz".equalsIgnoreCase(tttt))
{
enableFlag("QuestionUserRole");
xxxxxUserRole=new SAXQuestionUserRole();
}
else if (("useryyyyy".equalsIgnoreCase(tttt))
{
enableFlag("yyyyy");
useryyyyy = new LinkedHashSet<SAXQuestionUserRole>();
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.