Add static requireNonNull() method.

This commit is contained in:
akwizgran
2018-11-14 10:28:14 +00:00
parent 7866037d02
commit 6964a67ca3

View File

@@ -0,0 +1,15 @@
package org.briarproject.bramble.api.nullsafety;
import javax.annotation.Nullable;
@NotNullByDefault
public class NullSafety {
/**
* Stand-in for `Objects.requireNonNull()`.
*/
public static <T> T requireNonNull(@Nullable T t) {
if (t == null) throw new NullPointerException();
return t;
}
}