Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeFindFirstReAssignment.java
Tagir Valeev ebf320b288 Stream API migration various fixes
1. findFirst() scenario can pull previous assignment (not declaration) now
2. anyMatch() fix did not work if there's single assignment to non-variable (e.g. array element)
3. if non-adjacent return becomes unreachable after findFirst()/anyMatch(), it returned automatically now
2016-10-07 11:59:52 +07:00

25 lines
524 B
Java

// "Replace with findFirst()" "true"
import java.util.List;
import java.util.Map;
public class Main {
private int getInitialSize() {return 0;}
public void testMap(Map<String, List<String>> map) throws Exception {
int firstSize = 10;
System.out.println(firstSize);
firstSize = getInitialSize();
// loop
for(List<String> list : map.valu<caret>es()) {
if(list != null) {
firstSize = list.size();
// comment
break;
}
}
System.out.println(firstSize);
}
}