IDEA-182623 Replace with collect swallows comments

This commit is contained in:
Tagir Valeev
2017-11-27 15:22:26 +07:00
parent 5b8f3b2bfe
commit 5b36191d2c
29 changed files with 306 additions and 263 deletions
@@ -27,7 +27,9 @@ public class Main {
new Person("James", 25),
new Person("Kelly", 12)
);
Person maxPerson = personList.stream().filter(p -> p.getAge() > 13).max(Comparator.comparingInt(Person::getAge)).orElse(null);
/*age*/
Person maxPerson = personList.stream().filter(p -> p.getAge() > /*thirteen*/ 13).max(Comparator.comparingInt(Person::getAge)).orElse(null);
// max!
return maxPerson;
}
@@ -29,9 +29,9 @@ public class Main {
);
Person maxPerson = null;
for <caret>(Person p : personList) {
if(p.getAge() > 13) {
if (maxPerson == null || p.getAge() > maxPerson.getAge()) {
maxPerson = p;
if(p.getAge() > /*thirteen*/ 13) {
if (maxPerson == null || p./*age*/getAge() > maxPerson.getAge()) {
maxPerson = p; // max!
}
}
}