Better comment handling in ternary->if conversion & stream-to-loop

This commit is contained in:
Tagir Valeev
2019-04-19 11:45:55 +07:00
parent b89fd2edd5
commit e13567df50
6 changed files with 69 additions and 10 deletions

View File

@@ -5,7 +5,9 @@ import java.util.List;
public class Main {
private static String test(List<String> list) {
return list == null ? null : list.stream().filter(str -> str.contains("x")).find<caret>First().orElse(null);
return list == null ? // if list is null
null : // return null
list.stream().filter(str -> str.contains("x")).find<caret>First().orElse(null); // otherwise not null
}
public static void main(String[] args) {