package com.huawei.hms.utils; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; /* loaded from: classes2.dex */ public final class Checker { private Checker() { } public static void assertHandlerThread(Handler handler) { assertHandlerThread(handler, "Must be called on the handler thread"); } public static void assertNonEmpty(String str) { if (TextUtils.isEmpty(str)) { throw new IllegalStateException("Given String is empty or null"); } } public static T assertNonNull(T t) { if (t != null) { return t; } throw new NullPointerException("Null reference"); } public static void assertNotUiThread(String str) { if (Looper.myLooper() == Looper.getMainLooper()) { throw new IllegalStateException(str); } } public static void assertUiThread(String str) { if (Looper.myLooper() != Looper.getMainLooper()) { throw new IllegalStateException(str); } } public static String checkNonEmpty(String str) { if (TextUtils.isEmpty(str)) { throw new IllegalArgumentException("Given String is empty or null"); } return str; } public static T checkNonNull(T t) { if (t != null) { return t; } throw new NullPointerException("Null reference"); } public static int checkNonZero(int i) { if (i != 0) { return i; } throw new IllegalArgumentException("Given Integer is zero"); } public static long checkNotZero(long j) { if (j != 0) { return j; } throw new IllegalArgumentException("Given Long is zero"); } public static void assertHandlerThread(Handler handler, String str) { if (Looper.myLooper() != handler.getLooper()) { throw new IllegalStateException(str); } } public static T assertNonNull(T t, String str) { if (t != null) { return t; } throw new NullPointerException(String.valueOf(str)); } public static T checkNonNull(T t, String str) { if (t != null) { return t; } throw new NullPointerException(String.valueOf(str)); } public static int checkNonZero(int i, String str) { if (i != 0) { return i; } throw new IllegalArgumentException(String.valueOf(str)); } public static long checkNotZero(long j, String str) { if (j != 0) { return j; } throw new IllegalArgumentException(String.valueOf(str)); } public static void assertNonEmpty(String str, String str2) { if (TextUtils.isEmpty(str)) { throw new IllegalStateException(String.valueOf(str2)); } } public static String checkNonEmpty(String str, String str2) { if (TextUtils.isEmpty(str)) { throw new IllegalArgumentException(String.valueOf(str2)); } return str; } }