diff options
author | Malcolm Chen <refuhoo@google.com> | 2020-01-27 15:26:00 -0800 |
---|---|---|
committer | Xiangyu/Malcolm Chen <refuhoo@google.com> | 2020-02-06 03:34:13 +0000 |
commit | be998a7b68a4c0c4b472b09149ef0ac4be81c3af (patch) | |
tree | 5b0815aceda594b3f4447bec056b9485f85de741 /telephony/common/com/android | |
parent | ee6679031ed384a126867e485d0d7ddf686c3a25 (diff) |
Remoe usage of CollectionUtils as it's not exposed to mainline modules.
Bug: 140908357
Test: build
Change-Id: I5f56747be8bc4702e58b7fe27c21f7959bdd76de
Merged-In: I5f56747be8bc4702e58b7fe27c21f7959bdd76de
Diffstat (limited to 'telephony/common/com/android')
-rw-r--r-- | telephony/common/com/android/internal/telephony/util/TelephonyUtils.java | 7 |
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 2abcc76fdccc..ec1c6c90905a 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.function.Supplier; /** @@ -59,6 +61,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); |