mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
16 lines
442 B
Java
16 lines
442 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Collect {
|
|
public static void collectWithLambda(List<String> test) {
|
|
Runnable r = () -> {
|
|
List<String> result;
|
|
System.out.println("We're inside the lambda");
|
|
result = test.stream().map(String::trim).collect(Collectors.toList());
|
|
System.out.println(result);
|
|
};
|
|
r.run();
|
|
}
|
|
}
|