aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-11 10:22:01 +0300
committerGravatar Vitaly Takmazov2016-07-11 10:22:01 +0300
commitae9494bbca81e493f9a76da0029b113bf359e573 (patch)
treed0f87818a794dc7410a6b2456c492a1dd54293a5 /juick-core/src/main/java
parent7eb3b141e5e4e719e1ef77ea06b6bac7610ae913 (diff)
cleanup sql, part 2
Diffstat (limited to 'juick-core/src/main/java')
-rw-r--r--juick-core/src/main/java/com/juick/server/UserQueries.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/juick-core/src/main/java/com/juick/server/UserQueries.java b/juick-core/src/main/java/com/juick/server/UserQueries.java
index eb2918c0..1ba0f83b 100644
--- a/juick-core/src/main/java/com/juick/server/UserQueries.java
+++ b/juick-core/src/main/java/com/juick/server/UserQueries.java
@@ -30,6 +30,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
+import java.util.stream.Collectors;
/**
*
@@ -133,16 +134,7 @@ public class UserQueries {
}
public static boolean fillUsersByID(JdbcTemplate sql, List<User> users) {
- boolean ret = false;
-
- String uids = "";
- final int usersSize = users.size();
- for (int i = 0; i < usersSize; i++) {
- if (i > 0) {
- uids += ",";
- }
- uids += users.get(i).getUID();
- }
+ String uids = StringUtils.arrayToCommaDelimitedString(users.stream().map(u -> u.getUID()).collect(Collectors.toList()).toArray());
sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + uids + ")",
(rs, num) -> {