jeudi 28 mars 2019

How to refactor if statement using De Morgans law java

So I have a very unreadable if statement and someone suggested me to look at De Morgans law and refactor it so it would be more clean and readable. I got the idea how to do it with simple and short statements but I really do not know how to refactor my code. Note that first two are objects! Thanks for your help!


    if (!userTemplate.getFromAccount().equals(document.getDetails())
                        && !userTemplate.getBenAccount().equals(document.getFromAccount())
                        && !userTemplate.getDetails().equals(document.getBenAccount())
                        && !userTemplate.getBenType().equals(document.getBenType())
                        && !userTemplate.getAmount().equals(document.getCreditAmount()))


Aucun commentaire:

Enregistrer un commentaire