提交 6afcb082 编写于 作者: B Benjamin Winterberg

Use List.sort instead of Collections.sort

上级 7fa21e25
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册