From d3410680fd511a43a8de6e3060ecce04bb701aca Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 1 May 2020 17:48:56 +0300 Subject: [PATCH] variant of isEmptyOrNull for CharSequence --- app/src/main/java/net/ktnx/mobileledger/utils/Misc.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java index caa107c2..c4dc7875 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -72,4 +72,9 @@ public class Misc { public static boolean equalStrings(String a, String b) { return nullIsEmpty(a).equals(nullIsEmpty(b)); } + public static boolean isEmptyOrNull(CharSequence text) { + if (text == null) + return true; + return text.length() == 0; + } } -- 2.39.5