Fix several spelling mistakes and leftover debug code
authorMaciej Piechotka <uzytkownik2@gmail.com>
Sun, 7 Nov 2010 22:01:40 +0000 (22:01 +0000)
committerMaciej Piechotka <uzytkownik2@gmail.com>
Sun, 7 Nov 2010 22:01:40 +0000 (22:01 +0000)
gee/arraylist.vala
gee/iterator.vala
tests/testcollection.vala

index 949367f..5ea16bd 100644 (file)
@@ -364,7 +364,6 @@ public class Gee.ArrayList<G> : AbstractList<G> {
                
                public bool valid {
                        get {
-                               stderr.printf ("%d %s\n", _index, _removed ? "true" : "false");
                                return _index >= 0 && _index < _list._size && ! _removed;
                        }
                }
index 0b02dae..92a7d73 100644 (file)
@@ -80,7 +80,7 @@ public interface Gee.Iterator<G> : Object {
         * progress to next element when the operation repeats.
         *
         * Operation moves the iterator to last element in iteration. If iterator
-        * points at some element it will be included in iteration
+        * points at some element it will be included in iteration.
         */
        public virtual A fold<A> (FoldFunc<A, G> f, owned A seed)
        {
@@ -90,5 +90,18 @@ public interface Gee.Iterator<G> : Object {
                        seed = f (get (), (owned) seed);
                return (owned) seed;
        }
+       
+       /**
+        * Apply function to each element returned by iterator. 
+        *
+        * Operation moves the iterator to last element in iteration. If iterator
+        * points at some element it will be included in iteration.
+        */
+       public virtual void forall (ForallFunc<G> f) {
+               if (valid)
+                       f (get ());
+               while (next ())
+                       f (get ());
+       }
 }
 
index c8dd361..93171cf 100644 (file)
@@ -43,7 +43,7 @@ public abstract class CollectionTests : Gee.TestCase {
                add_test ("[Collection] retain_all", test_retain_all);
                add_test ("[Collection] to_array", test_to_array);
                add_test ("[Collection] GObject properties", test_gobject_properties);
-               add_test ("[Collection] fold", test_to_array);
+               add_test ("[Collection] fold", test_fold);
        }
 
        protected Collection<string> test_collection;