From 3a5a953b7d9bb1636cc9d770d2ff6f8799dbf397 Mon Sep 17 00:00:00 2001 From: Joe <736777445@qq.com> Date: Tue, 26 Nov 2019 15:59:18 +0800 Subject: [PATCH] =?UTF-8?q?Update=2030.=20=E4=BC=98=E5=85=88=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=B3=9B=E5=9E=8B=E6=96=B9=E6=B3=95.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/notes/30. 优先使用泛型方法.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/docs/notes/30. 优先使用泛型方法.md b/docs/notes/30. 优先使用泛型方法.md index a4d7b0a..9373d79 100644 --- a/docs/notes/30. 优先使用泛型方法.md +++ b/docs/notes/30. 优先使用泛型方法.md @@ -114,18 +114,13 @@ public static > E max(Collection c); ```java // Returns max value in a collection - uses recursive type bound public static > E max(Collection c) { - - if (c.isEmpty()) - throw new IllegalArgumentException("Empty collection"); - - E result = null; - - for (E e : c) - if (result == null || [e.compareTo(result](http://e.compareTo(result)) > 0) - result = Objects.requireNonNull(e); - - return result; - + if (c.isEmpty()) + throw new IllegalArgumentException("Empty collection"); + E result = null; + for (E e : c) + if (result == null || e.compareTo(result) > 0) + result = Objects.requireNonNull(e); + return result; } ```