Leverage basic Java 17 features (#451)
- Refactor code to use the following basic Java 17 features: - pattern matching for instanceof - @Serial annotation - switch expressions - enhanced switch statements - StringBuilder.isEmpty() - Replace two switch statements with simpler if statements. - Rename a few local variables.
This commit is contained in:
1 parent
3ab9e4184e
commit
a7c7e51180
142 files changed
+1333
-1798
No files matched your search
@@ -111,10 +111,10 @@ public class ListSort {
|
||||
// append `.length` to avoid rendering the list
|
||||
new ReplRequest.Eval("sort", "nums.sortWith(cmp).length", false, false))
|
||||
.get(0);
|
||||
if (!(response instanceof ReplResponse.EvalSuccess)) {
|
||||
if (!(response instanceof ReplResponse.EvalSuccess success)) {
|
||||
throw new AssertionError(response);
|
||||
}
|
||||
return ((ReplResponse.EvalSuccess) response).getResult();
|
||||
return success.getResult();
|
||||
}
|
||||
|
||||
// note that this is an uneven comparison
|
||||
|
||||
Reference in new issue
Block a user