diff options
author | Maciej Piechotka <uzytkownik2@gmail.com> | 2012-11-25 18:32:39 +0000 |
---|---|---|
committer | Maciej Piechotka <uzytkownik2@gmail.com> | 2012-11-25 18:35:35 +0000 |
commit | 4e41d9ddeeabafae12a5cdb33d85afa6484da177 (patch) | |
tree | d7542f9db9b3ebd1912be972874f7f42dc5d772c | |
parent | 19d1c24caaf201b689a923015d309141bb746b04 (diff) | |
download | libgee-4e41d9ddeeabafae12a5cdb33d85afa6484da177.tar.gz |
Fix Gee.List.Iterator.next
-rw-r--r-- | gee/linkedlist.vala | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala index 5c9cfd3..3167eff 100644 --- a/gee/linkedlist.vala +++ b/gee/linkedlist.vala @@ -424,18 +424,30 @@ public class Gee.LinkedList<G> : AbstractList<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; } |