This functionality is only available for certain module packages.

You are here: Reference > Formula Language > Formulas > Collections (collections of objects) > General methods for Collections > intoInject(Block expression,Object startValue)

intoInject(Block expression,Object startValue)

Accumulates a current value by evaluating expression.

intoInject(Block expression,Object startValue)
Arguments Block expression Expression that should be applied to all objects in the collection.
Object startValue Start value of the accumulation.
Return value Object Result of the accumulation

Description for the example 1:

Data in this example

Index number of iteration Index variable r Intermediate value accu Result value for r + accu
1 10 0 10
2 11 10 21
3 12 11 33

intoInject is used in practice, e.g., to apply Maps whose key-value pairs contain lists as values.

The following example shows how signal names are collected in a project and sorted in a map depending on their signal type.