public class Objects
extends java.lang.Object
| Constructor and Description |
|---|
Objects() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(java.lang.Object a,
java.lang.Object b) |
static <T> T |
requireNonNull(T obj) |
static <T> T |
requireNonNull(T obj,
java.lang.String message)
Checks that the specified object reference is not
null and throws a customized
IllegalArgumentException if it is. |
static <T extends java.util.Collection<?>> |
requireNonNullNorEmpty(T collection,
java.lang.String message)
Require a collection to be neither null, nor empty.
|
public static <T> T requireNonNull(T obj,
java.lang.String message)
throws java.lang.IllegalArgumentException
null and throws a customized
IllegalArgumentException if it is.
Note that unlike java.util.Objects, this method throws an IllegalArgumentException instead
of an NullPointerException.
T - the type of the reference.obj - the object reference to check for nullity.message - detail message to be used in the event that a IllegalArgumentException is thrown.obj if not null.java.lang.IllegalArgumentException - in case obj is null.public static <T> T requireNonNull(T obj)
public static <T extends java.util.Collection<?>> T requireNonNullNorEmpty(T collection,
java.lang.String message)
T - Collection typecollection - collectionmessage - error messagepublic static boolean equals(java.lang.Object a,
java.lang.Object b)