From dca2f0fec30e6acbdc466fd6dffb425877e7728a Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Wed, 16 Sep 2009 17:50:52 -0700 Subject: Make ParcelUuid helper functions consistent. Treat zero length arrays and null arrays to be same. Change-Id: I8c6c28e5dc3da1f31f6f6abfc747db4c2975a90b --- core/java/android/bluetooth/BluetoothUuid.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/java/android/bluetooth/BluetoothUuid.java b/core/java/android/bluetooth/BluetoothUuid.java index 409c744111d3..0596b21b03c9 100644 --- a/core/java/android/bluetooth/BluetoothUuid.java +++ b/core/java/android/bluetooth/BluetoothUuid.java @@ -98,7 +98,14 @@ public final class BluetoothUuid { */ public static boolean containsAnyUuid(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; - if (uuidA == null || uuidB == null) return false; + + if (uuidA == null) { + return uuidB.length == 0 ? true : false; + } + + if (uuidB == null) { + return uuidA.length == 0 ? true : false; + } HashSet uuidSet = new HashSet (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { @@ -117,7 +124,12 @@ public final class BluetoothUuid { */ public static boolean containsAllUuids(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; - if (uuidA == null || uuidB == null) return false; + + if (uuidA == null) { + return uuidB.length == 0 ? true : false; + } + + if (uuidB == null) return true; HashSet uuidSet = new HashSet (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { -- cgit v1.2.3-59-g8ed1b