2bd5a1f196
It will be needed for structure mutability inference #KT-21467 fixed #KT-32609 fixed #KT-32572 fixed #KT-24677 fixed
36 lines
1.1 KiB
Java
Vendored
36 lines
1.1 KiB
Java
Vendored
// RUNTIME_WITH_FULL_JDK
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
|
|
class Test {
|
|
public void main(List<String> lst) {
|
|
List<String> streamOfList = lst.stream()
|
|
.map(x -> x + "e")
|
|
.collect(Collectors.toList());
|
|
|
|
List<Integer> streamOfElements = Stream.of(1, 2, 3)
|
|
.map(x -> x + 1)
|
|
.collect(Collectors.toList());
|
|
|
|
Integer[] array = {1, 2, 3};
|
|
List<Integer> streamOfArray = Arrays.stream(array)
|
|
.map(x -> x + 1)
|
|
.collect(Collectors.toList());
|
|
|
|
List<Integer> streamOfArray2 = Stream.of(array)
|
|
.map(x -> x + 1)
|
|
.collect(Collectors.toList());
|
|
|
|
List<Integer> streamIterate = Stream.iterate(2, v -> v * 2)
|
|
.map(x -> x + 1)
|
|
.collect(Collectors.toList());
|
|
|
|
List<Integer> streamGenerate = Stream.generate(() -> 42)
|
|
.map(x -> x + 1)
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
|
} |