1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update java新特性总结.md

This commit is contained in:
anaer 2021-08-23 14:23:34 +08:00 committed by GitHub
parent 2cc2d9a969
commit fa7ca138ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,7 @@ jshell 是 Java 9 新增的一个实用工具。为 Java 提供了类似于 Pyth
```java ```java
List.of("Java", "C++"); List.of("Java", "C++");
Set.of("Java", "C++"); Set.of("Java", "C++");
Map.of("Java", 1, "C++", 2)`; Map.of("Java", 1, "C++", 2);
``` ```
使用 `of()` 创建的集合为不可变集合,不能进行添加、删除、替换、 排序等操作,不然会报 `java.lang.UnsupportedOperationException` 异常。 使用 `of()` 创建的集合为不可变集合,不能进行添加、删除、替换、 排序等操作,不然会报 `java.lang.UnsupportedOperationException` 异常。