From 6475487cf5eec2b59892a15040a2ee318619acff Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Thu, 1 Feb 2018 14:07:59 +0900 Subject: [PATCH] Polish SqlParameter.sqlTypesToAnonymousParameterList() --- .../org/springframework/jdbc/core/SqlParameter.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java index 30024ba36d85..cc0bc49bddae 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlParameter.java @@ -185,15 +185,12 @@ public boolean isResultsParameter() { * to a List of SqlParameter objects as used in this package. */ public static List sqlTypesToAnonymousParameterList(@Nullable int... types) { - List result; - if (types != null) { - result = new ArrayList<>(types.length); - for (int type : types) { - result.add(new SqlParameter(type)); - } + if (types == null) { + return new LinkedList<>(); } - else { - result = new LinkedList<>(); + List result = new ArrayList<>(types.length); + for (int type : types) { + result.add(new SqlParameter(type)); } return result; }