Merge: Basename fix
[nit.git] / lib / core / collection / abstract_collection.nit
index b65db67..6b07149 100644 (file)
@@ -228,6 +228,16 @@ interface Iterator[E]
        # Iterate over `self`
        fun iterator: Iterator[E] do return self
 
+       # Pre-iteration hook.
+       #
+       # Used to inform `self` that the iteration is starting.
+       # Specific iterators can use this to prepare some resources.
+       #
+       # Is automatically invoked at the beginning of `for` structures.
+       #
+       # Do nothing by default.
+       fun start do end
+
        # Post-iteration hook.
        #
        # Used to inform `self` that the iteration is over.
@@ -708,6 +718,16 @@ interface MapIterator[K, V]
        # Set a new `item` at `key`.
        #fun item=(item: E) is abstract
 
+       # Pre-iteration hook.
+       #
+       # Used to inform `self` that the iteration is starting.
+       # Specific iterators can use this to prepare some resources.
+       #
+       # Is automatically invoked at the beginning of `for` structures.
+       #
+       # Do nothing by default.
+       fun start do end
+
        # Post-iteration hook.
        #
        # Used to inform `self` that the iteration is over.