[Solved] If statement skipping || if first condition is false [closed]


The solution may be, that you need to put your statements in brackets.

else if ((address.getLastName() != null ? address.getLastName().toLowerCase().contains(searchKey) : false)
                    || (address.getFirstName() != null ? address.getFirstName().toLowerCase().contains(searchKey) : false)
                    || (address.getTitle() != null ? address.getTitle().toLowerCase().contains(searchKey) : false)
                    || (address.getStreet() != null ? address.getStreet().toLowerCase().contains(searchKey) : false)
                    || Integer.toString(address.getPlz()).equals(searchKey)) {
                outputList.add(address);

Otherwise the statements are not executed in the right order.

solved If statement skipping || if first condition is false [closed]