commit | 0ab5f70868fe61a724754f8b3615313cebe9b498 | [log] [tgz] |
---|---|---|
author | Hungming Chen <nuccachen@google.com> | Fri Aug 27 16:51:21 2021 +0800 |
committer | Hungming Chen <nuccachen@google.com> | Fri Aug 27 17:38:05 2021 +0800 |
tree | c4cb48931003a172b8ebb61490ca91443a5306e9 | |
parent | e2ac49699094bda05c37f793b48bc9f835a1e366 [diff] |
Refactor CollectionUtils.contains for short Keep the consistent style as CollectionUtils.contains for int because the compiler already does the optimization. Test: atest NetworkStaticLibTests Change-Id: Ide49c3761c552e8e184889a2f8d9f1aa8a130d60
diff --git a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java index 9eb2c22..6e1af55 100644 --- a/staticlibs/framework/com/android/net/module/util/CollectionUtils.java +++ b/staticlibs/framework/com/android/net/module/util/CollectionUtils.java
@@ -125,8 +125,8 @@ */ 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) { + for (int element : array) { + if (element == value) { return true; } }