Add CollectionUtils.contains for short
Test: atest NetworkStaticLibTests
Change-Id: I0ed29cc5dad20a3c52df8e1643aed65f6b2f50c7
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) {