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
void fun1(List<Integers> ints) {
ints.stream()
.filter(it -> it > 100)
.map(it -> it + 10)
.map(it -> it / 2)
.forEach(System.out::println)
}
void fun1(List<Integers> ints) {
for (int i : ints) {
if (i > 100) {
int x = i + 10;
int y = i / 2;
System.out.println(y);
}
}
}
The first function uses a lambda, the second uses an imperative for loop. For the first function, the plugin calculates the complexity of 8 and only 6 for the second one.
If we increase the number of lambdas then the calculated difference of complexity will be even greater. In other words, the plugin suggests using imperative code instead of lambdas.
The text was updated successfully, but these errors were encountered:
Let's compare the two functions below
The first function uses a lambda, the second uses an imperative for loop. For the first function, the plugin calculates the complexity of 8 and only 6 for the second one.
If we increase the number of lambdas then the calculated difference of complexity will be even greater. In other words, the plugin suggests using imperative code instead of lambdas.
The text was updated successfully, but these errors were encountered: