From 840b5071566e4acfca0378967c586b7d42fe90a9 Mon Sep 17 00:00:00 2001 From: Nadim Ritter Date: Wed, 7 Feb 2024 16:23:29 +0100 Subject: [PATCH] SEBSERV-427 improve getSelectedTableIndices --- .../service/session/ClientConnectionTable.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java index d28e6342..28214040 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java @@ -9,6 +9,7 @@ package ch.ethz.seb.sebserver.gui.service.session; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -843,16 +844,19 @@ public final class ClientConnectionTable implements FullPageMonitoringGUIUpdate return new int[]{}; } - List selectedTableIndices = new ArrayList<>(); + int[] selectedTableIndices = new int[connectionTokens.size()]; + int index = 0; + int tableIndices = 0; + for (UpdatableTableItem item : this.tableMapping.values()) { if (connectionTokens.contains(item.staticData.connectionToken)) { - selectedTableIndices.add(index); + selectedTableIndices[index] = tableIndices; + index++; } - index++; + tableIndices++; } - - return selectedTableIndices.stream().mapToInt(i -> i).toArray(); + return selectedTableIndices; } -} +} \ No newline at end of file