We're gonna use standart parameterised constructor, instead of addAll method.

This commit is contained in:
vraskulin 2017-02-09 17:42:05 +03:00
parent 192110cd68
commit 433b08238f
3 changed files with 3 additions and 6 deletions

View file

@ -272,8 +272,7 @@ public class ChatManager {
} }
public ArrayList<ChatSession> getChatSessions() { public ArrayList<ChatSession> getChatSessions() {
ArrayList<ChatSession> chatSessionList = new ArrayList<>(); ArrayList<ChatSession> chatSessionList = new ArrayList<>(chatSessions.values());
chatSessionList.addAll(chatSessions.values());
return chatSessionList; return chatSessionList;
} }

View file

@ -388,8 +388,7 @@ public class TableManager {
debugServerState(); debugServerState();
} }
logger.debug("TABLE HEALTH CHECK"); logger.debug("TABLE HEALTH CHECK");
ArrayList<Table> tableCopy = new ArrayList<>(); ArrayList<Table> tableCopy = new ArrayList<>(tables.values());
tableCopy.addAll(tables.values());
for (Table table : tableCopy) { for (Table table : tableCopy) {
try { try {
if (table.getState() != TableState.FINISHED) { if (table.getState() != TableState.FINISHED) {

View file

@ -168,8 +168,7 @@ public class UserManager {
private void checkExpired() { private void checkExpired() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE, -3); calendar.add(Calendar.MINUTE, -3);
List<User> usersToCheck = new ArrayList<>(); List<User> usersToCheck = new ArrayList<>(users.values());
usersToCheck.addAll(users.values());
for (User user : usersToCheck) { for (User user : usersToCheck) {
if (!user.getUserState().equals(UserState.Expired) && user.isExpired(calendar.getTime())) { if (!user.getUserState().equals(UserState.Expired) && user.isExpired(calendar.getTime())) {
removeUser(user.getId(), DisconnectReason.SessionExpired); removeUser(user.getId(), DisconnectReason.SessionExpired);