X-Git-Url: http://nitlanguage.org diff --git a/examples/circular_list.nit b/examples/circular_list.nit index 86e41f6..dd4e54d 100644 --- a/examples/circular_list.nit +++ b/examples/circular_list.nit @@ -21,10 +21,6 @@ class CircularList[E] # Like standard Array or LinkedList, CircularList is a Sequence. super Sequence[E] - # NaiveCollection contains working (but inefficient) implementation of - # the methods of Collection. - super NaiveCollection[E] - # The first node of the list if any # The special case of an empty list is handled by a null node private var node: nullable CLNode[E] = null @@ -124,11 +120,11 @@ end private class CircularListIterator[E] super IndexedIterator[E] - redef var index: Int + redef var index: Int = 0 # The current node pointed. # Is null if the list is empty. - var node: nullable CLNode[E] + var node: nullable CLNode[E] is noinit # The list iterated. var list: CircularList[E] @@ -148,11 +144,9 @@ private class CircularListIterator[E] redef fun item do return self.node.item - init(list: CircularList[E]) + init do self.node = list.node - self.list = list - self.index = 0 end end