summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2021-03-11 01:03:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-03-11 01:03:15 +0000
commit78e2f0d1241a0cf777f2681bd3b88139f70229e8 (patch)
tree5718f711a1f78df4ac99a3ce171b60913fef9320 /common
parent98e9e80694639337aa91daa2091767aa9937d0d6 (diff)
parenta72ce3d528f25a860564a8faa5266dde57321caf (diff)
downloadnet-78e2f0d1241a0cf777f2681bd3b88139f70229e8.tar.gz
Merge "Add helper function to check if collection is empty"
Diffstat (limited to 'common')
-rw-r--r--common/framework/com/android/net/module/util/CollectionUtils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/framework/com/android/net/module/util/CollectionUtils.java b/common/framework/com/android/net/module/util/CollectionUtils.java
index 115f19d0..2223443d 100644
--- a/common/framework/com/android/net/module/util/CollectionUtils.java
+++ b/common/framework/com/android/net/module/util/CollectionUtils.java
@@ -38,6 +38,13 @@ public final class CollectionUtils {
}
/**
+ * @return True if the collection is null or 0-length.
+ */
+ public static <T> boolean isEmpty(@Nullable Collection<T> collection) {
+ return collection == null || collection.isEmpty();
+ }
+
+ /**
* Returns an int array from the given Integer list.
*/
@NonNull