Class Objects
- java.lang.Object
-
- com.couchbase.client.core.lang.backport.java.util.Objects
-
public class Objects extends Object
Backport of some utility methods from Java 1.7+
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T object)
Returns the given object if it is non-null, otherwise throws NullPointerException.- Parameters:
object
- the object to check for nullity- Returns:
- the given object
- Throws:
NullPointerException
- if object is null
-
requireNonNull
public static <T> T requireNonNull(T object, String message)
Returns the given object if it is non-null, otherwise throws NullPointerException with the given message.- Parameters:
object
- the object to check for nullitymessage
- the detail message to use if the object is null- Returns:
- the given object
- Throws:
NullPointerException
- if object is null
-
-