Inspirel banner

Programming Distributed Systems with YAMI4

3.9.3 Java

Iteration support is provided by an additional nested class Parameters.EntryIterator, which implements the java.util.Iterator interface.

The Parameters class itself implements java.util.Iterable, which means that it can be naturally used in the extended for loop or in the more elaborated iteration idiom.

The only standard operation which is not supported is remove().

A typical usage pattern could be similar to the following code that prints the names of all entries in the given parameters object:

for (Parameters.Entry e : params) {
    System.out.println(e.name());
}

Note:

Individual entries can be modified during the iteration, but they should not be added nor removed from the collection while the iteration is in progress.

The size of the whole collection can be always obtained with the size() function of the parameters object.