mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
19 lines
981 B
HTML
19 lines
981 B
HTML
<html>
|
|
<body>
|
|
Reports usages of Guava pseudo-functional code when <code>Java Stream API</code> is available.
|
|
<p>Though <code>Guava Iterable API</code> provides functionality similar to <code>Java Streams API</code>, it's slightly different and
|
|
may miss some features.
|
|
Especially, primitive-specialized stream variants like <code>IntStream</code> are more performant than generic variants.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
List<String> transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>List<String> transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());</code></pre>
|
|
<p>
|
|
<b>Note:</b> Code semantics can be changed; for example, Guava's <code>Iterable.transform</code> produces a lazy-evaluated iterable,
|
|
but the replacement is eager-evaluated.
|
|
</p>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |