end
# Associative arrays that internally uses couples to represent each (key, value) pairs.
+# This is an helper class that some specific implementation of Map may implements.
interface CoupleMap[K: Object, E]
super Map[K, E]
+
# Return the couple of the corresponding key
# Return null if the key is no associated element
protected fun couple_at(key: K): nullable Couple[K, E] is abstract
+ # Return a new iteralot on all couples
+ # Used to provide `iterator` and others
+ protected fun couple_iterator: Iterator[Couple[K,E]] is abstract
+
+ redef fun iterator do return new CoupleMapIterator[K,E](couple_iterator)
+
redef fun [](key)
do
var c = couple_at(key)
# Iterator on CoupleMap
#
-# Actually is is a wrapper around an iterator of the internal array of the map.
-class CoupleMapIterator[K: Object, E]
+# Actually it is a wrapper around an iterator of the internal array of the map.
+private class CoupleMapIterator[K: Object, E]
super MapIterator[K, E]
redef fun item do return _iter.item.second
# O(1)
redef fun length do return _items.length
- redef fun iterator: CoupleMapIterator[K, E] do return new CoupleMapIterator[K, E](_items.iterator)
+ redef fun couple_iterator do return _items.iterator
redef fun is_empty do return _items.is_empty