[libgee] Fix several spelling mistakes and leftover debug code



commit 3f9a32690d3f6ca9a80d69e92985dafb1bf97204
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Sun Nov 7 22:01:40 2010 +0000

    Fix several spelling mistakes and leftover debug code

 gee/arraylist.vala        |    1 -
 gee/iterator.vala         |   15 ++++++++++++++-
 tests/testcollection.vala |    2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gee/arraylist.vala b/gee/arraylist.vala
index 949367f..5ea16bd 100644
--- a/gee/arraylist.vala
+++ b/gee/arraylist.vala
@@ -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;
 			}
 		}
diff --git a/gee/iterator.vala b/gee/iterator.vala
index 0b02dae..92a7d73 100644
--- a/gee/iterator.vala
+++ b/gee/iterator.vala
@@ -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 ());
+	}
 }
 
diff --git a/tests/testcollection.vala b/tests/testcollection.vala
index c8dd361..93171cf 100644
--- a/tests/testcollection.vala
+++ b/tests/testcollection.vala
@@ -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;



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