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 codeAfter 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.
- 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
This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
//noinspection StaticPseudoFunctionalStyleMethodnote
Actual comment syntax will depend on the code language you are working with
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |