From 6afcb082a58de258a6e368e7a63d8a1cb65053ab Mon Sep 17 00:00:00 2001 From: Benjamin Winterberg Date: Thu, 12 Nov 2015 13:48:11 +0100 Subject: [PATCH] Use List.sort instead of Collections.sort --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4826f5a..f738541 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Collections.sort(names, (String a, String b) -> b.compareTo(a)); For one line method bodies you can skip both the braces `{}` and the `return` keyword. But it gets even more shorter: ```java -Collections.sort(names, (a, b) -> b.compareTo(a)); +names.sort((a, b) -> b.compareTo(a)); ``` The java compiler is aware of the parameter types so you can skip them as well. Let's dive deeper into how lambda expressions can be used in the wild. -- GitLab