- Checks that the specified object reference is not null, and throws a customized NullPointException if it is.
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; }
- Objcets.equals
public static boolean equals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); }
- Objects.deepEquals
* Returns {@code true} if the arguments are deeply equal to each other * and {@code false} otherwise.
public static boolean deepEquals(Object a, Object b) { if (a == b) return true; else if (a == null || b == null) return false; else return Arrays.deepEquals0(a, b); }
转载于:https://my.oschina.net/u/4055223/blog/3061163