[geary/mjog/invert-folder-class-hierarchy: 40/72] Geary.Collection: Add single_set method




commit 39004d758af7ecb6c8ab16e05eed6aecbf963fe4
Author: Michael Gratton <mike vee net>
Date:   Wed Feb 17 18:44:07 2021 +1100

    Geary.Collection: Add single_set method

 src/engine/util/util-collection.vala | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/engine/util/util-collection.vala b/src/engine/util/util-collection.vala
index 4cf8316e3..e2ae44c44 100644
--- a/src/engine/util/util-collection.vala
+++ b/src/engine/util/util-collection.vala
@@ -23,6 +23,13 @@ namespace Geary.Collection {
         return single;
     }
 
+    /** Returns a modifiable set containing a single element. */
+    public Gee.Set<E> single_set<E>(E element) {
+        var single = new Gee.HashSet<E>();
+        single.add(element);
+        return single;
+    }
+
     /** Returns a copy of the given collection in a new collection. */
     public Gee.Collection<V> copy<V>(Gee.Collection<V> original) {
         // Use a linked list, the returned value can't be accessed by


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]