Inspectopedia 2024.3 Help

Guava pseudo-functional call can be converted to Stream API call

Reports usages of Guava pseudo-functional code when Java Stream API is available.

Though Guava Iterable API provides functionality similar to Java Streams API, it's slightly different and may miss some features. Especially, primitive-specialized stream variants like IntStream are more performant than generic variants.

Example:

List<String> transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code

After the quick-fix is applied:

List<String> transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());

Note: Code semantics can be changed; for example, Guava's Iterable.transform produces a lazy-evaluated iterable, but the replacement is eager-evaluated.

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.

StaticPseudoFunctionalStyleMethod
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 | Java | Java language level migration aids | Java 8

This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.3, Qodana for JVM 2024.3,

Can be installed with plugin:

Java, 243.23126

Last modified: 03 December 2024