diff options
author | Yi-an Chen <theianchen@google.com> | 2023-04-11 01:53:46 +0000 |
---|---|---|
committer | Yi-an Chen <theianchen@google.com> | 2023-04-11 01:56:24 +0000 |
commit | 17abe36e0d7a3da791baddeb3dfdecda1c3d8e4e (patch) | |
tree | e2177f3e4def333791516770cdc94877f8c06beb /PermissionController/src/com/android/permissioncontroller/permission/utils | |
parent | db511ca386480adbd985c3159ed16f0d70a6171c (diff) | |
download | Permission-17abe36e0d7a3da791baddeb3dfdecda1c3d8e4e.tar.gz |
Add CollectionUtilsTest
Bug: 274702991
For R coverage calculation:
Expect to remove 5 lines and add 10 lines of coverage
Test: COllectionUtilsTest
Change-Id: I1a1730bd97ac867c3e8ee7fc02e539218d0b5f91
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/permission/utils')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/permission/utils/CollectionUtils.java | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/utils/CollectionUtils.java b/PermissionController/src/com/android/permissioncontroller/permission/utils/CollectionUtils.java index 6f2a3079d..108120ced 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/utils/CollectionUtils.java +++ b/PermissionController/src/com/android/permissioncontroller/permission/utils/CollectionUtils.java @@ -16,8 +16,6 @@ package com.android.permissioncontroller.permission.utils; -import android.util.ArraySet; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -59,29 +57,6 @@ public final class CollectionUtils { } /** - * Remove all values in the array set that do <b>not</b> exist in the given collection. - * - * @param <T> the class of the elements to retain and of the {@code ArraySet} - * @param arraySet the {@code ArraySet} whose elements are to be removed or retained - * @param valuesToRetain the values to be used to determine which elements to retain - * - * @return {@code true} if any values were removed from the array set, {@code false} otherwise. - * - * @see ArraySet#retainAll(java.util.Collection) - */ - @SafeVarargs - public static <T> boolean retainAll(ArraySet<T> arraySet, T... valuesToRetain) { - boolean removed = false; - for (int i = arraySet.size() - 1; i >= 0; i--) { - if (!ArrayUtils.contains(valuesToRetain, arraySet.valueAt(i))) { - arraySet.removeAt(i); - removed = true; - } - } - return removed; - } - - /** * Return a singleton list containing the element, or an empty list if the element is * {@code null}. * |