Skip to content

Commit 573b081

Browse files
committed
Day-14 : Generate the first 10 numbers of the Fibonacci Sequence
1 parent 4243ecb commit 573b081

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.java8;
2+
3+
import java.util.stream.Stream;
4+
5+
public class GenerateFibbonaciSequence {
6+
public static void main(String[] args) {
7+
Stream.iterate(new int[]{0, 1}, f -> new int[]{f[1], f[0] + f[1]})
8+
.limit(10)
9+
.map(f -> f[0])
10+
.forEach(System.out::println);
11+
}
12+
}

0 commit comments

Comments
 (0)