Add Gee.TreeSet.foreach implementation
authorMaciej Piechotka <uzytkownik2@gmail.com>
Mon, 15 Jul 2013 23:01:20 +0000 (01:01 +0200)
committerMaciej Piechotka <uzytkownik2@gmail.com>
Mon, 15 Jul 2013 23:01:20 +0000 (01:01 +0200)
gee/treeset.vala

index af8105f..c4212df 100644 (file)
@@ -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);
        }