[libgee] Add Gee.TreeSet.foreach implementation



commit e7e4a6746eac1bedc20d170b489143678575fa71
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Tue Jul 16 01:01:20 2013 +0200

    Add Gee.TreeSet.foreach implementation

 gee/treeset.vala |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gee/treeset.vala b/gee/treeset.vala
index af8105f..c4212df 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -345,6 +345,18 @@ public class Gee.TreeSet<G> : AbstractBidirSortedSet<G> {
        /**
         * { inheritDoc}
         */
+       public override bool foreach (ForallFunc<G> f) {
+               for (unowned Node<G> node = _first; node != null; node = node.next) {
+                       if (!f (node.key)) {
+                               return false;
+                       }
+               }
+               return true;
+       }
+
+       /**
+        * { inheritDoc}
+        */
        public override Gee.Iterator<G> iterator () {
                return new Iterator<G> (this);
        }


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