It's better to revert back to using if (lastName.trim().equals("")) rather than if(lastName.isEmpty()).