mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
IDEA-205309 'Replace with findFirst()' produces uncompilable source
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Scratch {
|
||||
public void setStatus(List<MutablePair> destinations, String destination, Integer status) {
|
||||
destinations.stream().filter(pair -> pair.first.compareTo(destination) == 0).findFirst().ifPresent(pair -> pair.second = status);
|
||||
}
|
||||
|
||||
private static class MutablePair {
|
||||
String first;
|
||||
Integer second;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// "Replace with findFirst()" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class Scratch {
|
||||
public void setStatus(List<MutablePair> destinations, String destination, Integer status) {
|
||||
fo<caret>r (MutablePair pair : destinations) {
|
||||
if (pair.first.compareTo(destination) == 0) {
|
||||
pair.second = status;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class MutablePair {
|
||||
String first;
|
||||
Integer second;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user