mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 02:21:17 +07:00
13 lines
390 B
Java
13 lines
390 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Test {
|
|
static String test(List<String> list) {
|
|
String sb;
|
|
System.out.println("hello");
|
|
sb = list.stream().filter(s -> !s.isEmpty()).map(String::trim).collect(Collectors.joining("", "1" + 2, ""));
|
|
return sb.length() == 0 ? null : sb;
|
|
}
|
|
} |