diff options
author | Chiachang Wang <chiachangwang@google.com> | 2021-03-11 01:03:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-03-11 01:03:15 +0000 |
commit | 78e2f0d1241a0cf777f2681bd3b88139f70229e8 (patch) | |
tree | 5718f711a1f78df4ac99a3ce171b60913fef9320 /common | |
parent | 98e9e80694639337aa91daa2091767aa9937d0d6 (diff) | |
parent | a72ce3d528f25a860564a8faa5266dde57321caf (diff) | |
download | net-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.java | 7 |
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 |