summaryrefslogtreecommitdiff
path: root/telephony/common
diff options
context:
space:
mode:
authorMalcolm Chen <refuhoo@google.com>2020-01-27 15:26:00 -0800
committerXiangyu/Malcolm Chen <refuhoo@google.com>2020-01-28 04:29:45 +0000
commit55e9590016ba9d9b7f62a8dfcdf3da5893af7c89 (patch)
treef398e5a3533359b9a1aedf49ce78561346162e8a /telephony/common
parent747d9d5cf9b6d756d4d779fcbf82cb3d399801ef (diff)
Remoe usage of CollectionUtils as it's not exposed to mainline modules.
Bug: 140908357 Test: build Change-Id: I5f56747be8bc4702e58b7fe27c21f7959bdd76de
Diffstat (limited to 'telephony/common')
-rw-r--r--telephony/common/com/android/internal/telephony/util/TelephonyUtils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
index a7ad884ca107..682697469af9 100644
--- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
+++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
@@ -28,6 +28,8 @@ import android.os.RemoteException;
import android.os.SystemProperties;
import java.io.PrintWriter;
+import java.util.Collections;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
@@ -61,6 +63,11 @@ public final class TelephonyUtils {
return str == null ? "" : str;
}
+ /** Returns an empty list if the input is {@code null}. */
+ public static @NonNull <T> List<T> emptyIfNull(@Nullable List<T> cur) {
+ return cur == null ? Collections.emptyList() : cur;
+ }
+
/** Throws a {@link RuntimeException} that wrapps the {@link RemoteException}. */
public static RuntimeException rethrowAsRuntimeException(RemoteException remoteException) {
throw new RuntimeException(remoteException);