[libgee/0.8] Fix Gee.List.Iterator.next



commit ca3f36f22868e004f9e8b8978679944ac6593861
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Sun Nov 25 18:32:39 2012 +0000

    Fix Gee.List.Iterator.next

 gee/linkedlist.vala |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index 52e74c9..54e7cf8 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -447,18 +447,30 @@ public class Gee.LinkedList<G> : AbstractBidirList<G>, Queue<G>, Deque<G> {
 		public bool next () {
 			assert (this._stamp == this._list._stamp);
 
-			if (this.removed && this.position != null) {
-				this.removed = false;
-				return true;
-			} else if (!this.started && this._list._head != null) {
-				this.started = true;
-				this.position = this._list._head;
-				this._index++;
-				return true;
-			} else if (this.position != null && this.position.next != null) {
-				this.position = this.position.next;
-				this._index++;
-				return true;
+			if (this.removed) {
+				if (this.position != null) {
+					this.removed = false;
+					return true;
+				} else {
+					return false;
+				}
+			} else if (!this.started) {
+				if (this._list._head != null) {
+					this.started = true;
+					this.position = this._list._head;
+					this._index++;
+					return true;
+				} else {
+					return false;
+				}
+			} else if (this.position != null) {
+				if (this.position.next != null) {
+					this.position = this.position.next;
+					this._index++;
+					return true;
+				} else {
+					return false;
+				}
 			}
 			return false;
 		}



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