commit | 4dfe1ff50a9aaee99983e65cdaededf8b7e7ef81 | [log] [tgz] |
---|---|---|
author | Chiachang Wang <chiachangwang@google.com> | Wed Feb 24 17:54:33 2021 +0800 |
committer | Chiachang Wang <chiachangwang@google.com> | Thu Feb 25 11:55:51 2021 +0800 |
tree | a7ce4cdb8ae455f37b0b579ac321767c915d4433 | |
parent | 3c9f315167fcded480d0a3a1be4e45563c761272 [diff] |
Add helper function to check if collection is empty Bug: 172183305 Test: m Change-Id: I3b7b415d39f8a1fffb43ace58772da554412d25e
diff --git a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java index e5bb58d..cd1d35e 100644 --- a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java +++ b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java
@@ -38,6 +38,13 @@ } /** + * @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