Skip to content

Commit d3bcbd6

Browse files
authored
Merge pull request #2673 from Wenweigood/main
优化格式 & 补充集合转Map时的常见异常
2 parents db72d11 + 7980d03 commit d3bcbd6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/java/collection/java-collection-precautions-for-use.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public static <T> T requireNonNull(T obj) {
134134
return obj;
135135
}
136136
```
137+
> `Collectors`也提供了无需mergeFunction的`toMap()`方法,但此时若出现key冲突,则会抛出`duplicateKeyException`异常,因此强烈建议使用`toMap()`方法必填mergeFunction。
137138
138139
## 集合遍历
139140

docs/java/concurrent/java-concurrent-questions-02.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class Singleton {
6060
private Singleton() {
6161
}
6262

63-
public static Singleton getUniqueInstance() {
63+
public static Singleton getUniqueInstance() {
6464
//先判断对象是否已经实例过,没有实例化过才进入加锁代码
6565
if (uniqueInstance == null) {
6666
//类对象加锁

0 commit comments

Comments
 (0)