Java 7/8 And The Built-In Assertion : Adam Bien's Weblog
Java 7/8 And The Built-In Assertion
The java.util.Objects utility class comes with a useful null-check assertions: requireNonNull
Instead of checking a variable with if-statements you can use the built-in method:
import static java.util.Objects.requireNonNull; (...) requireNonNull(this.script, "Cannot initialize ScriptableSink without script."); Read full article from Java 7/8 And The Built-In Assertion : Adam Bien's Weblog
No comments:
Post a Comment