Skip to content

Commit 1097d62

Browse files
committed
Enhance a slide in Lecture 08 deck
1 parent b8bbe29 commit 1097d62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

08-lambdas-and-stream-api/lecture/slides.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,15 +930,17 @@ double result = employees.reduce(
930930
<br>
931931

932932
```java
933+
// Java 8+ (returns modifiable List)
933934
List<Integer> list = Stream.of(1, 2, 3, 4, 5)
934935
.collect(Collectors.toList()); // [1, 2, 3, 4, 5]
935936

936-
// since Java 16
937+
// Java 16+ (returns unmodifiable List)
937938
List<Integer> list = Stream.of(1, 2, 3, 4, 5)
938939
.toList();
939-
940940
```
941941

942+
- По контракт `Stream.toList()` е еквивалентен на `Collectors.toUnmodifiableList()`.
943+
942944
---
943945

944946
### Още колектори

0 commit comments

Comments
 (0)