convert to stream: support nested conditions

This commit is contained in:
Anna Kozlova
2014-11-12 19:37:57 +01:00
parent 747c2bfa78
commit 0aeef103be
3 changed files with 74 additions and 48 deletions
@@ -0,0 +1,10 @@
// "Replace with forEach" "true"
import java.util.ArrayList;
import java.util.List;
class Sample {
List<String> foo = new ArrayList<>();
{
foo.stream().filter(s -> s != null).filter(s -> s.startsWith("a")).forEach(System.out::println);
}
}
@@ -0,0 +1,16 @@
// "Replace with forEach" "true"
import java.util.ArrayList;
import java.util.List;
class Sample {
List<String> foo = new ArrayList<>();
{
for (String s : fo<caret>o) {
if (s != null) {
if (s.startsWith("a")) {
System.out.println(s);
}
}
}
}
}