From 9acee05e5ed04449706c37e0906c21b06a92036e Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 6 Dec 2023 20:56:03 +0100 Subject: [PATCH] [core] Improve how the selected keys are copied in SmackReactor --- .../src/main/java/org/jivesoftware/smack/SmackReactor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java index 67e68f1fd..4fc43fcce 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java @@ -1,6 +1,6 @@ /** * - * Copyright 2018-2020 Florian Schmaus + * Copyright 2018-2023 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -276,8 +276,7 @@ public class SmackReactor { setInterestOpsCancelledKeySafe(selectionKey, 0); } - selectedKeys = new ArrayList<>(selectedKeySet.size()); - selectedKeys.addAll(selectedKeySet); + selectedKeys = new ArrayList<>(selectedKeySet); selectedKeySet.clear(); }