Skip to content

Instantly share code, notes, and snippets.

@up1
Created January 13, 2015 03:11
Show Gist options
  • Save up1/a0482d79751d82710136 to your computer and use it in GitHub Desktop.
Save up1/a0482d79751d82710136 to your computer and use it in GitHub Desktop.
Java 8 Stream :: Validate
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