WifiSettings cleanup; emptyListi() instead of null
Change-Id: I0fced1f00ff259aed98988f0913383c50a3c6427
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 5eec6e3..22ba3bd 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -513,11 +513,9 @@
}
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 @@
}
}
- //
+ // Pre-sort accessPoints to speed preference insertion
Collections.sort(accessPoints);
return accessPoints;
}
@@ -535,9 +533,10 @@
/** A restricted multimap for use in constructAccessPoints */
private class Multimap<K,V> {
private HashMap<K,List<V>> store = new HashMap<K,List<V>>();
- /** retrieve a possibly null list of values with key K */
+ /** retrieve a non-null list of values with key K */
List<V> getAll(K key) {
- return store.get(key);
+ List<V> values = store.get(key);
+ return values != null ? values : Collections.<V>emptyList();
}
void put(K key, V val) {