Create a singleton HashMap instead of using Collections.singleton()

The Set returned by Collections.singleton() doesn't support all
operations, causing crashes in certain situations (namely, whenever
a notification is updated rather than added or removed).

Change-Id: Ie104b7f99c4a32db5f1f7e43ec3775d34dc26ce1
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 267cb2a..be3297c 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -60,6 +60,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Locale;
 import java.util.Set;
 import java.util.concurrent.Executor;
@@ -648,4 +649,14 @@
             throw new RuntimeException(e);
         }
     }
+
+    /**
+     * Returns a HashSet with a single element. We use this instead of Collections.singleton()
+     * because HashSet ensures all operations, such as remove, are supported.
+     */
+    public static <T> HashSet<T> singletonHashSet(T elem) {
+        HashSet<T> hashSet = new HashSet<>(1);
+        hashSet.add(elem);
+        return hashSet;
+    }
 }