mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 02:21:17 +07:00
15 lines
378 B
Java
15 lines
378 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<Integer> list) {
|
|
String sb = "";
|
|
if(!list.isEmpty()) {
|
|
sb = list.stream().filter(i -> i != 0).map(String::valueOf).collect(Collectors.joining());
|
|
}
|
|
String s = sb;
|
|
return s.trim();
|
|
}
|
|
} |