mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
15 lines
390 B
Java
15 lines
390 B
Java
// "Collapse loop with stream 'anyMatch()/noneMatch()/allMatch()'" "true-preview"
|
|
|
|
import java.util.List;
|
|
|
|
public class Main {
|
|
public void testAssignment(List<String> data) {
|
|
boolean found;
|
|
if(Math.random() > 0.5) {
|
|
found = true;
|
|
} else {
|
|
found = data.stream().map(String::trim).anyMatch(trimmed -> !trimmed.isEmpty());
|
|
}
|
|
System.out.println(found);
|
|
}
|
|
} |