mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 02:21:17 +07:00
18 lines
531 B
Java
18 lines
531 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Main {
|
|
private List<String> test(String[] list, int limit) {
|
|
List<String> result;
|
|
List<String> other = new ArrayList<>();
|
|
System.out.println("hello");
|
|
result = Arrays.stream(list).filter(Objects::nonNull).limit(limit).map(s -> s + s).sorted().collect(Collectors.toList());
|
|
return result;
|
|
}
|
|
}
|