projects
/
platform
/
upstream
/
libgee.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
769ac73
)
Add the implementation for HashSet.foreach
author
Maciej Piechotka
<uzytkownik2@gmail.com>
Mon, 15 Jul 2013 17:45:26 +0000
(19:45 +0200)
committer
Maciej Piechotka
<uzytkownik2@gmail.com>
Mon, 15 Jul 2013 17:45:26 +0000
(19:45 +0200)
gee/hashset.vala
patch
|
blob
|
history
diff --git
a/gee/hashset.vala
b/gee/hashset.vala
index
65c8f40
..
b196c58
100644
(file)
--- 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) {