mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-03 11:47:50 +07:00
16 lines
508 B
Java
16 lines
508 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
|
|
class Test {
|
|
public static <T> List<TokenFilter<T>> fromString(final T src, Function<T, List<String>> extractor) {
|
|
final List<TokenFilter<T>> result = extractor.apply(src).stream().map(st -> new TokenFilter<T>(st)).collect(Collectors.toList());
|
|
return result;
|
|
}
|
|
|
|
static class TokenFilter<T> {
|
|
public TokenFilter(String s) {
|
|
}
|
|
}
|
|
} |