[geary/mjog/invert-folder-class-hierarchy: 344/362] Geary.Collection: Add single_set method
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/invert-folder-class-hierarchy: 344/362] Geary.Collection: Add single_set method
- Date: Wed, 24 Feb 2021 11:54:51 +0000 (UTC)
commit 00e4dc77f455bd95e7382e6345e295d6c6ddb89a
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]