anyone has ideas about making this block of if-else statements simpler other than purely using switch-case statements? Thanks for your time!
public void onButtonClick(int type, int state) {
if (type == 1) {
if (state == 1)
jsonDataToString(); // method 1
else if (state == 2)
filterRecordFile(); // method 2
else if (state == 3)
filterResourceFile(); // method 3
} else if (type == 2) {
if (state == 1)
jsonDataToString(); // method 1
else if (state == 2)
filterHasBackup(); // method 4
else if (state == 3)
filterNotBackup(); // method 5
}
}
Aucun commentaire:
Enregistrer un commentaire