Inspectopedia Help

Guava's functional primitives can be replaced with Java

Reports usages of Guava's functional primitives that can be migrated to standard Java API calls.

For example, the inspection reports usages of classes and interfaces like FluentIterable, Optional, Function, Predicate, or Supplier.

Example:

ImmutableList<String> results = FluentIterable.from(List.of(1, 2, 3)).transform(Object::toString).toList();

After the quick-fix is applied:

List<String> results = List.of(1, 2, 3).stream().map(Object::toString).collect(Collectors.toList());

The quick-fix may change the semantics. Some lazy-evaluated Guava's iterables can be transformed to eager-evaluated.

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

Inspection options

Here you can find the description of settings available for the Guava's functional primitives can be replaced with Java inspection, and the reference of their default values.

Report variables

Default: Selected

Report method chains

Default: Selected

Report return types

Default: Selected

Erase @javax.annotations.Nullable from converted functions

Default: Selected

Inspection Details

Available in:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,

Plugin:

Java, 242.SNAPSHOT

Last modified: 20 February 2024