[libgee] Add the implementation for HashSet.foreach
- From: Maciej Marcin Piechotka <mpiechotka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgee] Add the implementation for HashSet.foreach
- Date: Mon, 15 Jul 2013 19:14:23 +0000 (UTC)
commit 9817bcbfffb3321697f585282dbf0adb4c37829a
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date: Mon Jul 15 19:45:26 2013 +0200
Add the implementation for HashSet.foreach
gee/hashset.vala | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gee/hashset.vala b/gee/hashset.vala
index 65c8f40..b196c58 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -165,6 +165,20 @@ public class Gee.HashSet<G> : AbstractSet<G> {
resize ();
}
+ /**
+ * { inheritDoc}
+ */
+ public override bool foreach (ForallFunc f) {
+ for (int i = 0; i < _array_size; i++) {
+ for (unowned Node<G>? current = _nodes[i]; current != null; current = current.next) {
+ if (!f (current.key)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
private inline bool remove_helper (G key) {
Node<G>** node = lookup_node (key);
if (*node != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]