Stream operations can have one of two following types:
- Intermidiate
- Terminal
Some of the examples:
- filter
- map
- limit
Some of the examples:
- forEach
- reduce
- collect
- min max count
- anyMatch allMatch noneMatch
- Out of list
list.stream()
- via agruments
Stream<Integer> stream = Stream.of(1,2);
can be generated via Stream.generate()
Stream.generate(new Random()::nextInt)
.limit(10).forEach(System.out::println);
Accepts, doesnt return mostly used for printing out
Accepts and returns
Doesnt accepts, returns