Skip to content

Commit 727b14b

Browse files
author
a.yazychyan
committed
Use new java version features
1 parent 0b8c815 commit 727b14b

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentTypePreparedStatementSetter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public void setValues(PreparedStatement ps) throws SQLException {
6161
if (this.args != null && this.argTypes != null) {
6262
for (int i = 0; i < this.args.length; i++) {
6363
Object arg = this.args[i];
64-
if (arg instanceof Collection && this.argTypes[i] != Types.ARRAY) {
65-
Collection<?> entries = (Collection<?>) arg;
64+
if (arg instanceof Collection<?> entries && this.argTypes[i] != Types.ARRAY) {
6665
for (Object entry : entries) {
6766
if (entry instanceof Object[] valueArray) {
6867
for (Object argValue : valueArray) {

spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,7 @@ public void setValues(PreparedStatement ps) throws SQLException {
265265
}
266266
declaredParameter = declaredParameters.get(i);
267267
}
268-
if (in instanceof Iterable && declaredParameter.getSqlType() != Types.ARRAY) {
269-
Iterable<?> entries = (Iterable<?>) in;
268+
if (in instanceof Iterable<?> entries && declaredParameter.getSqlType() != Types.ARRAY) {
270269
for (Object entry : entries) {
271270
if (entry instanceof Object[] valueArray) {
272271
for (Object argValue : valueArray) {

spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,7 @@ public String nextStringValue() throws DataAccessException {
133133
String s = Long.toString(getNextKey());
134134
int len = s.length();
135135
if (len < this.paddingLength) {
136-
StringBuilder sb = new StringBuilder(this.paddingLength);
137-
for (int i = 0; i < this.paddingLength - len; i++) {
138-
sb.append('0');
139-
}
140-
sb.append(s);
141-
s = sb.toString();
136+
s = "0".repeat(this.paddingLength - len) + s;
142137
}
143138
return s;
144139
}

0 commit comments

Comments
 (0)