mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
12 lines
359 B
Java
12 lines
359 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Main {
|
|
List<String> getStrings(List<?> list) {
|
|
List<String> result = list.stream().filter(o -> o instanceof String).map(o -> (String) o).collect(Collectors.toList());
|
|
return result;
|
|
}
|
|
} |