commit | b2a595bc04b17db417f43c22be618e1a0eb542ff | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Fri Aug 27 05:21:44 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Aug 27 05:21:44 2021 +0000 |
tree | 17e346db0639b17b8a84fa3d23f49432ae2894a9 | |
parent | 9a405ea89d9c3d867a7c65c72300cf91c0fe3f33 [diff] | |
parent | 14eb0f3d6ac831bfb06c7e6f7efac27508508bf3 [diff] |
Merge "Add CollectionUtils.contains for short" am: 35570f4599 am: c6c2efc42f Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1802483 Change-Id: I43f3d2fdd32b5b8bbf726a6e20c36a09eb2e71ec
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) {