| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,7 +108,7 @@ Collections.sort(names, (String a, String b) -> b.compareTo(a)); | |||
| 108 | 108 | For one line method bodies you can skip both the braces `{}` and the `return` keyword. But it gets even more shorter: | |
| 109 | 109 | ||
| 110 | 110 | ```java | |
| 111 | - Collections.sort(names, (a, b) -> b.compareTo(a)); | ||
| 111 | + names.sort((a, b) -> b.compareTo(a)); | ||
| 112 | 112 | ``` | |
| 113 | 113 | ||
| 114 | 114 | 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. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments