From cc38b493927167f9c8aa43020c1bf4d3a870abf0 Mon Sep 17 00:00:00 2001 From: Isaac Levy Date: Fri, 26 Aug 2011 14:20:14 -0700 Subject: [PATCH] WifiSettings cleanup; emptyListi() instead of null Change-Id: I0fced1f00ff259aed98988f0913383c50a3c6427 --- src/com/android/settings/wifi/WifiSettings.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 5eec6e3e217..22ba3bd7c47 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -513,11 +513,9 @@ public class WifiSettings extends SettingsPreferenceFragment } boolean found = false; - if (apMap.getAll(result.SSID) != null) { - for (AccessPoint accessPoint : apMap.getAll(result.SSID)) { - if (accessPoint.update(result)) - found = true; - } + for (AccessPoint accessPoint : apMap.getAll(result.SSID)) { + if (accessPoint.update(result)) + found = true; } if (!found) { AccessPoint accessPoint = new AccessPoint(getActivity(), result); @@ -527,7 +525,7 @@ public class WifiSettings extends SettingsPreferenceFragment } } - // + // Pre-sort accessPoints to speed preference insertion Collections.sort(accessPoints); return accessPoints; } @@ -535,9 +533,10 @@ public class WifiSettings extends SettingsPreferenceFragment /** A restricted multimap for use in constructAccessPoints */ private class Multimap { private HashMap> store = new HashMap>(); - /** retrieve a possibly null list of values with key K */ + /** retrieve a non-null list of values with key K */ List getAll(K key) { - return store.get(key); + List values = store.get(key); + return values != null ? values : Collections.emptyList(); } void put(K key, V val) {