The JADE 2022 release meets tomorrow’s business demands.
Foreach support for Iterable interfaces
With the addition of the new JadeIterableIF and JadeReverseIterableIF RootSchema interface, it will be possible to add compiler support to the foreach statement allowing the developer to iterate over any object that implements one or both interfaces. This will allow iteration over real or virtual collections.
foreach shape in shapesIterable as Shape do
In this example, any class that implements JadeIterableIF or Collection of Shape objects can be provided as a parameter to this method and provided its iterator retrieves Shape objects, it will behave in a generic manner. Due to the non-generic nature of these interfaces, the new foreach as clause must be used, which performs a check at runtime to make sure the retrieved object is of the type specified in the as clause expression.