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; } ```