You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several types of Stream#collect(..) calls for which a simpler and more canonical alternative exists. We should nudge users to use those features.
Description of the proposed new feature
Support a stylistic preference.
Avoid a common gotcha, or potential problem.
Improve performance.
Concretely, the idea is to implement Refaster rules for each of the cases mentioned by SonarCloud rule S4266.
So to take the first example mentioned by the rule, we would like to rewrite the following code:
stream.collect(counting())
to:
stream.count()
Considerations
Some of these rules are parametric on a comparator or mapping. Make sure that those Refaster rules use the maximally generic type, such as Comparator<? super T> in case of comparator. See the method signatures of the replaced methods for details.
Problem
There are several types of
Stream#collect(..)
calls for which a simpler and more canonical alternative exists. We should nudge users to use those features.Description of the proposed new feature
Concretely, the idea is to implement Refaster rules for each of the cases mentioned by SonarCloud rule S4266.
So to take the first example mentioned by the rule, we would like to rewrite the following code:
to:
Considerations
comparator
ormapping
. Make sure that those Refaster rules use the maximally generic type, such asComparator<? super T>
in case ofcomparator
. See the method signatures of the replaced methods for details.@SuppressWarnings("java:S4266")
to the new@BeforeTemplate
methods. See the changes in Introduce SonarCloud integration and resolve assorted violations #575 for similar suppressions.The text was updated successfully, but these errors were encountered: