mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 06:11:42 +07:00
IDEA-160802 fixed case with collection summing
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with sum()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
interface Person {
|
||||
int getAge();
|
||||
}
|
||||
|
||||
public long test(List<Person> collection) {
|
||||
long i = collection.stream().mapToLong(Person::getAge).sum();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with sum()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
interface Person {
|
||||
int getAge();
|
||||
}
|
||||
|
||||
public long test(List<Person> collection) {
|
||||
long i = 0;
|
||||
for(Person person : collecti<caret>on) {
|
||||
i = i + person.getAge();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user