From 6f3f2c90fe9d8d28f9a21c6cb58a769753d1b716 Mon Sep 17 00:00:00 2001 From: Wenweigood <76194364+Wenweigood@users.noreply.github.com> Date: Tue, 13 May 2025 19:44:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/java/concurrent/java-concurrent-questions-02.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/java/concurrent/java-concurrent-questions-02.md b/docs/java/concurrent/java-concurrent-questions-02.md index f3bb411a..40c1b140 100644 --- a/docs/java/concurrent/java-concurrent-questions-02.md +++ b/docs/java/concurrent/java-concurrent-questions-02.md @@ -60,7 +60,7 @@ public class Singleton { private Singleton() { } - public static Singleton getUniqueInstance() { + public static Singleton getUniqueInstance() { //先判断对象是否已经实例过,没有实例化过才进入加锁代码 if (uniqueInstance == null) { //类对象加锁 From 7980d032650f7edb265eba66308cdde31ba89b8c Mon Sep 17 00:00:00 2001 From: Wenweigood <76194364+Wenweigood@users.noreply.github.com> Date: Tue, 13 May 2025 19:57:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=9B=86=E5=90=88=E8=BD=ACMap=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E5=B8=B8=E8=A7=81=E6=83=85?= =?UTF-8?q?=E5=BD=A2=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/java/collection/java-collection-precautions-for-use.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/java/collection/java-collection-precautions-for-use.md b/docs/java/collection/java-collection-precautions-for-use.md index cb68403f..9bd3a408 100644 --- a/docs/java/collection/java-collection-precautions-for-use.md +++ b/docs/java/collection/java-collection-precautions-for-use.md @@ -134,6 +134,7 @@ public static T requireNonNull(T obj) { return obj; } ``` +> `Collectors`也提供了无需mergeFunction的`toMap()`方法,但此时若出现key冲突,则会抛出`duplicateKeyException`异常,因此强烈建议使用`toMap()`方法必填mergeFunction。 ## 集合遍历