Last active
January 3, 2016 09:59
-
-
Save tadams/8446081 to your computer and use it in GitHub Desktop.
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
import static java.util.Objects.requireNonNull; | |
... | |
// throws a NullPointerException when null | |
requireNonNull(employee); | |
// throws a NullPointerException with a message | |
requireNonNull(employee, "employee reference is null"); | |
// throws a NullPointerException with a message from a supplier function | |
requireNonNull(employee, () -> errorMsgProducer.getNullMessage("employee")); | |
// do paycheck stuff ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment