Modernize code for diamond, isEmpty & pattern matching

This commit is contained in:
Tran Ngoc Nhan
2024-09-24 01:42:38 +07:00
committed by GitHub
parent 40faaa0c15
commit fc377126de
107 changed files with 550 additions and 454 deletions

View File

@@ -86,6 +86,7 @@ import org.springframework.util.StringUtils;
* @author Meherzad Lahewala
* @author Trung Pham
* @author Johannes Edmeier
* @author Ngoc Nhan
*
* @since 2.2
*/
@@ -609,7 +610,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
Assert.state(messages.size() < 2,
() -> "The query must return zero or 1 row; got " + messages.size() + " rows");
if (messages.size() > 0) {
if (!messages.isEmpty()) {
final Message<?> message = messages.get(0);
UUID id = message.getHeaders().getId();

View File

@@ -79,6 +79,7 @@ import org.springframework.util.StringUtils;
* @author Will Schipp
* @author Gary Russell
* @author Artem Bilan
* @author Ngoc Nhan
*
* @since 2.0
*/
@@ -752,7 +753,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore
groupIdKey, this.region, groupIdKey, this.region);
Assert.state(messages.size() < 2,
() -> "The query must return zero or 1 row; got " + messages.size() + " rows");
if (messages.size() > 0) {
if (!messages.isEmpty()) {
return messages.get(0);
}
return null;