add nested stream filter recognition

This commit is contained in:
Roman Ivanov
2017-08-24 11:35:17 +07:00
parent 930ec09d12
commit aaee667ca7
4 changed files with 80 additions and 13 deletions
@@ -0,0 +1,15 @@
// "Replace with findFirst()" "true"
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Main {
class MappedField{
List<MappedField> getLoadNames(){return null;}
}
public MappedField getMappedField(final String storedName) {
List<MappedField> persistenceFields = new ArrayList<>();
return persistenceFields.stream().filter(mf -> mf.getLoadNames().stream().anyMatch(storedName::equals)).findFirst().orElse(null);
}
}
@@ -0,0 +1,22 @@
// "Replace with findFirst()" "true"
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Main {
class MappedField{
List<MappedField> getLoadNames(){return null;}
}
public MappedField getMappedField(final String storedName) {
List<MappedField> persistenceFields = new ArrayList<>();
for<caret> (final MappedField mf : persistenceFields) {
for (final String n : mf.getLoadNames()) {
if (storedName.equals(n)) {
return mf;
}
}
}
return null;
}
}