Skip to content

Commit 243d43e

Browse files
authored
Update README.md
1 parent a7aa834 commit 243d43e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,19 @@ https://pypi.org/project/java-stream/
88
```bash
99
pip install java-stream
1010
```
11+
## Usage
12+
```py
13+
from stream import Stream
14+
15+
# Generate a list of 100 random numbers
16+
Stream.randint(1, 100).limit(100).toList()
17+
18+
# Generate a list of the numbers from 1 to 100
19+
Stream.iterate(1, lambda i: i + 1).limit(100).toList()
20+
21+
# Generate a list of squares of the number from 1 to 100
22+
Stream.iterate(1, lambda i: i + 1).map(lambda x: x**2).limit(100).toList()
23+
24+
# Generate a list of 0 with a lenght of 100
25+
Stream.generate(lambda: 0).limit(100).toList()
26+
```

0 commit comments

Comments
 (0)