public class Objects extends Object
Backport of some utility methods from Java 1.7+
Modifier and Type | Method and Description |
---|---|
static <T> T |
requireNonNull(T object)
Returns the given object if it is non-null, otherwise throws NullPointerException.
|
static <T> T |
requireNonNull(T object,
String message)
Returns the given object if it is non-null, otherwise throws NullPointerException with the given message.
|
public static <T> T requireNonNull(T object)
Returns the given object if it is non-null, otherwise throws NullPointerException.
object
- the object to check for nullityNullPointerException
- if object is nullpublic static <T> T requireNonNull(T object, String message)
Returns the given object if it is non-null, otherwise throws NullPointerException with the given message.
object
- the object to check for nullitymessage
- the detail message to use if the object is nullNullPointerException
- if object is nullCopyright © 2018 Couchbase, Inc.. All rights reserved.