mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 02:21:17 +07:00
12 lines
336 B
Java
12 lines
336 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Main {
|
|
public Set<String> test(String[] array) {
|
|
/*initial count*/
|
|
Set<String> set = Arrays.stream(array).filter(Objects::nonNull).limit(10).collect(Collectors.toSet());
|
|
return set;
|
|
}
|
|
} |