You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: document/_java.learnMoreAboutCleanUps.md
+48-2
Original file line number
Diff line number
Diff line change
@@ -220,7 +220,7 @@ if (object instanceof Integer i) {
220
220
```
221
221
222
222
223
-
### `lambdaExpression`
223
+
### `lambdaExpressionFromAnonymousClass`
224
224
225
225
Convert anonymous class declarations for functional interfaces to lambda expressions wherever possible. It is only applicable for Java level 8 or above.
226
226
@@ -297,4 +297,50 @@ final FileInputStream inputStream = new FileInputStream("out.txt");
297
297
try (inputStream) {
298
298
System.out.println(inputStream.read());
299
299
}
300
-
```
300
+
```
301
+
302
+
### `lambdaExpression`
303
+
304
+
Cleans up lambda expression wherever possible in the following ways:
305
+
306
+
1. Removes unnecessary parentheses.
307
+
308
+
For example:
309
+
310
+
```java
311
+
(someString) -> someString.trim().toLowerCase();
312
+
```
313
+
314
+
becomes:
315
+
316
+
```java
317
+
someString -> someString.trim().toLowerCase();
318
+
```
319
+
320
+
2.Converts lambda expression blocks to a single statement when possible.
0 commit comments