mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-03 11:47:50 +07:00
11 lines
369 B
Java
11 lines
369 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Test {
|
|
List<String> test(int[] repeats) {
|
|
List<String> result = Arrays.stream(repeats).mapToObj(val -> Collections.nCopies(val, String.valueOf(val))).flatMap(Collection::stream).collect(Collectors.toList());
|
|
return result;
|
|
}
|
|
}
|