Skip to content

Commit 39c4539

Browse files
committed
Usando Collectors para convertir Streams
1 parent 68a7939 commit 39c4539

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.platzi.functional._13_streams;
22

3+
import java.util.List;
4+
import java.util.stream.Collectors;
35
import java.util.stream.IntStream;
46

57
public class TypeStream {
68
public static void main(String[] args) {
79
IntStream infiniteStream = IntStream.iterate(0, x -> x + 1);
8-
infiniteStream.limit(1000)
9-
.parallel()
10+
List<Integer> numbersList = infiniteStream.limit(1000)
1011
.filter(x -> x % 2 == 0)
11-
.forEach(System.out::println);
12+
.boxed()
13+
.collect(Collectors.toList());
14+
15+
1216
}
1317
}

0 commit comments

Comments
 (0)