I have the following code on a huge project. I want to find a better implementation to avoid the same code
if(CConst.CONST1.equals(SOMETHING1)){
const1fieldsaver = true;
if(a != 0){
//same code
if(value <= 0){
const1field = ...//same code
}
}
if(CConst.CONST2.equals(SOMETHING2)){
const2fieldsaver = true;
if(a != 0){
//same code
if(value <= 0){
const2field = ...//same code
}
}
how can i avoid these to if statements? The have the same code but as you can see it save the values to different variables. Is there any more efficient way to implement this?
Aucun commentaire:
Enregistrer un commentaire