mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 18:58:31 +07:00
This case is possible only if we have no non-final locals updated in the loop, so the assignment updates field or array element. Using common assignment scenario may not work as primitive optionals lack map/filter operations Fixes IDEA-200209 "Replace with findFirst" produces incompilable code
19 lines
442 B
Java
19 lines
442 B
Java
// "Replace with findFirst()" "true"
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
class Lookup {
|
|
boolean matches(char[] lookup) {}
|
|
}
|
|
|
|
// IDEA-200209
|
|
class C {
|
|
private Lookup[] lookbehindFormats;
|
|
private char[] lookupChars;
|
|
private Lookup lookbehindFormat;
|
|
|
|
{
|
|
IntStream.range(0, lookbehindFormats.length).filter(i -> lookbehindFormats[i].matches(lookupChars)).findFirst().ifPresent(i -> lookbehindFormat = lookbehindFormats[i]);
|
|
|
|
}
|
|
} |