I have a method which checks null's, I s there a way to short the method to less rows? the code looks "dirty"
private int similarityCount (String one, String two) {
if (one==null && two==null) {
return 1;
} else if (one==null && two!=null) {
return 2;
} else if (one!=null && two==null) {
return 3;
} else {
if(isMatch(one, two))
return 4;
return 5;
}
}
Thanks
Aucun commentaire:
Enregistrer un commentaire