Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6afcb08

Browse filesBrowse files
committed
Use List.sort instead of Collections.sort
1 parent 7fa21e2 commit 6afcb08
Copy full SHA for 6afcb08

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Collections.sort(names, (String a, String b) -> b.compareTo(a));
108108
For one line method bodies you can skip both the braces `{}` and the `return` keyword. But it gets even more shorter:
109109

110110
```java
111-
Collections.sort(names, (a, b) -> b.compareTo(a));
111+
names.sort((a, b) -> b.compareTo(a));
112112
```
113113

114114
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.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.