diff options
author | Maciej Piechotka <uzytkownik2@gmail.com> | 2013-07-15 19:51:16 +0200 |
---|---|---|
committer | Maciej Piechotka <uzytkownik2@gmail.com> | 2013-07-15 19:51:16 +0200 |
commit | fd10371c60e12f9b93325355e6d4c51b0411fdcb (patch) | |
tree | f242f0a83fbf4a7d1436374ce8fedb165cc48369 | |
parent | 9817bcbfffb3321697f585282dbf0adb4c37829a (diff) | |
download | libgee-fd10371c60e12f9b93325355e6d4c51b0411fdcb.tar.gz |
Add the implementation for PriorityQueue.foreach
-rw-r--r-- | gee/priorityqueue.vala | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gee/priorityqueue.vala b/gee/priorityqueue.vala index d6f6abe..9b2cbdc 100644 --- a/gee/priorityqueue.vala +++ b/gee/priorityqueue.vala @@ -103,7 +103,7 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> { public override bool is_full { get { return false; } } - + /** * {@inheritDoc} */ @@ -368,6 +368,18 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> { return new Iterator<G> (this); } + /** + * {@inheritDoc} + */ + public override bool foreach (ForallFunc f) { + for (unowned Node<G>? current = _iter_head; current != null; current = current.iter_next) { + if (!f (current.data)) { + return false; + } + } + return true; + } + private inline int _compare (Node<G> node1, Node<G> node2) { // Assume there can't be two nodes pending drop if (node1.pending_drop) { |