public static <T> T requireNonNull (T obj)

Checks that the specified object reference is not null. This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below:

 public Foo(Bar bar) {
     this.bar = Objects.requireNonNull(bar);
 }
 

Parameters:
obj    the object reference to check for nullity
<T>    the type of the reference

Returns:  obj if not null

Exceptions:
NullPointerException    if obj is null