Resolve PMD warning - combine if statement. Also refactored to a method to make conditional clearer.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
Removed unused field.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>