SPARK-2378: ChatContainer: avoid allocation of ArrayList() on iteration

This commit is contained in:
Sergey Ponomarev
2025-11-15 13:48:12 +02:00
committed by Guus der Kinderen
parent 1b7eda406e
commit 541eaf336b

View File

@ -537,7 +537,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
return;
}
for (ChatRoom chatRoom : new ArrayList<>(chatRoomList)) {
for (ChatRoom chatRoom : chatRoomList) {
closeTab(chatRoom);
chatRoom.closeChatRoom();
}
@ -1475,7 +1475,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
public void closeAllGroupChatRooms() {
for (ChatRoom chatRoom : new ArrayList<>(chatRoomList)) {
for (ChatRoom chatRoom : chatRoomList) {
boolean isGroup = chatRoom.getChatType() == Message.Type.groupchat;
if (isGroup) {
closeTab(chatRoom);
@ -1485,7 +1485,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
public boolean hasGroupChatRooms() {
for (ChatRoom chatRoom : new ArrayList<>(chatRoomList)) {
for (ChatRoom chatRoom : chatRoomList) {
boolean isGroup = chatRoom.getChatType() == Message.Type.groupchat;
if (isGroup) {
return true;