# See the License for the specific language governing permissions and
# limitations under the License.
-# Implementation of circular lists
+# Example of an implementation of circular lists
# This example shows the usage of generics and somewhat a specialisation of collections.
-module circular_list
+module circular_list is example
# Sequences of elements implemented with a double-linked circular list
class CircularList[E]
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]
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