Enhance switch statements

Issue #4365
This commit is contained in:
Minsoo Kim
2023-05-03 14:05:03 +09:00
committed by Mahmoud Ben Hassine
parent 7460c5f9a1
commit 4a971a0764
5 changed files with 53 additions and 119 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,18 +39,12 @@ class AggregateItemReaderTests {
@Nullable
@Override
public AggregateItem<String> read() {
switch (count++) {
case 0:
return AggregateItem.getHeader();
case 1:
case 2:
case 3:
return new AggregateItem<>("line");
case 4:
return AggregateItem.getFooter();
default:
return null;
}
return switch (count++) {
case 0 -> AggregateItem.getHeader();
case 1, 2, 3 -> new AggregateItem<>("line");
case 4 -> AggregateItem.getFooter();
default -> null;
};
}
};