lib/android: Changed entry to execute complete_simple_android by default
[nit.git] / examples / circular_list.nit
index 8b99d48..c3ba1ed 100644 (file)
@@ -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,7 +120,7 @@ end
 private class CircularListIterator[E]
        super IndexedIterator[E]
 
-       redef var key: Int
+       redef var index: Int
 
        # The current node pointed.
        # Is null if the list is empty.
@@ -137,13 +133,13 @@ private class CircularListIterator[E]
        do
                # Empty lists are not OK.
                # Pointing again the first node is not OK.
-               return self.node != null and (self.key == 0 or self.node != self.list.node)
+               return self.node != null and (self.index == 0 or self.node != self.list.node)
        end
 
        redef fun next
        do
                self.node = self.node.next
-               self.key += 1
+               self.index += 1
        end
 
        redef fun item do return self.node.item
@@ -152,7 +148,7 @@ private class CircularListIterator[E]
        do
                self.node = list.node
                self.list = list
-               self.key = 0
+               self.index = 0
        end
 end