commit | 14eb0f3d6ac831bfb06c7e6f7efac27508508bf3 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Fri Aug 27 05:02:15 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Aug 27 05:02:15 2021 +0000 |
tree | 17e346db0639b17b8a84fa3d23f49432ae2894a9 | |
parent | ff5da506618753be040e298e64d8a92498088bf0 [diff] | |
parent | e2ac49699094bda05c37f793b48bc9f835a1e366 [diff] |
Merge "Add CollectionUtils.contains for short" am: 35570f4599 Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1802483 Change-Id: Ib6e05a150e1d72b6c740520c6100935905f8769a
diff --git a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java index 0696cca..9eb2c22 100644 --- a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java +++ b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java
@@ -123,6 +123,19 @@ /** * @return true if the array contains the specified value. */ + public static boolean contains(@Nullable short[] array, short value) { + if (array == null) return false; + for (int i = 0; i < array.length; i++) { + if (array[i] == value) { + return true; + } + } + return false; + } + + /** + * @return true if the array contains the specified value. + */ public static boolean contains(@Nullable int[] array, int value) { if (array == null) return false; for (int element : array) {