## Notes
Provides support for functional-style operations on streams of elements, like map-reduce transformations. It's an addition to [[Java Collections]] that allows developers to perform functional programming on those collections.
```java
List<String> myList = Arrays.from("a", "b", "c", "d", "e");
myList.stream()
.forEach(System.out::println);
// Automatically creates threads for you!
myList.parallelStream()
.forEach(System.out::println);
```
Can also create a stream via:
```java
List<Integer> myInts = Arrays.asList(0, 1, 2, 3, 4);
Stream<Integer> myIntStream = myInts.stream();
```
## Types of Methods
- Intermediate: `filter` and `map`
- Terminate: `findFirst` and `forEach`
Intermediate methods
- Might not even execute
- Can be lazy
Terminate methods cannot be chained, I think.
`findFirst()` returns `Optional`
## References
- [Stream API in Java - YouTube](https://www.youtube.com/watch?v=9Orn0Pwp3YU)
- [[Study for EPAM Backend Interview]]