Created
January 13, 2015 03:11
-
-
Save up1/a0482d79751d82710136 to your computer and use it in GitHub Desktop.
Java 8 Stream :: Validate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PersonValidator { | |
public boolean validate(Person person) { | |
boolean valid = person != null; | |
if (valid) { | |
valid = person.getName() != null; | |
} | |
if (valid) { | |
valid = person.getEmail() != null; | |
} | |
if (valid) { | |
valid = person.getGender() != null; | |
} | |
return valid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment