Inspectopedia Help

Too long same methods chain

Reports long Reactive Streams transformation chains.

Each operator method call, such as map() or filter(), creates some objects for those operators. Calling a long chain of operators on each subscription, for each stream element, may cause performance overhead. To avoid it, combine a long chain of calls into one operator call wherever possible.

Example:

Flux.just(1, 2, 3) .map(it -> it + 1) .map(it -> it + 2) .map(it -> it + 3)

After the quick-fix is applied:

Flux.just(1, 2, 3) .map(it -> it + 1 + 2 + 3)

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ReactiveStreamsTooLongSameOperatorsChain
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Reactive Streams | Common

New in 2019.3

Inspection options

Here you can find the description of settings available for the Too long same methods chain inspection, and the reference of their default values.

The longest allowed same methods chain length

2

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,

Can be installed with plugin:

Reactive Streams, 242.22892

Last modified: 11 September 2024