mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-12 04:36:59 +07:00
12 lines
377 B
Java
12 lines
377 B
Java
// "Collapse loop with stream 'toArray()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.stream.IntStream;
|
|
import java.util.stream.Stream;
|
|
|
|
public class Test {
|
|
String[] test(int count) {
|
|
return IntStream.range(0, count).mapToObj(i -> Stream.of("one", "two", "three")).flatMap(Function.identity()).toArray(String[]::new);
|
|
}
|
|
}
|