From a40655ad0ce1c9bd0d99b549918e0c18b51990a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Andr=C3=A9=20Pearce?= Date: Tue, 26 Feb 2019 20:02:56 +0000 Subject: [PATCH] Support removal using values iterator. (#8866) Motivation: As ActiveMQ project using netty, we want to make use of this class, unfortunately the iterator on values(), seems to not support remove method, even so the delegated iterator does. Currently we have to clone and modify this class locally albeit a one line change is needed, it would be ideal if netty could allow remove, then removing the need to maintain a clone. Modifications: * remove throws UnsupportedOperationException, and instead call remove method on delegated iterator Result: Be able to call Iterator.remove() for the values. --- .../templates/io/netty/util/collection/KObjectHashMap.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/templates/io/netty/util/collection/KObjectHashMap.template b/common/src/main/templates/io/netty/util/collection/KObjectHashMap.template index d8aeb1b25c..7db1ceb6c3 100644 --- a/common/src/main/templates/io/netty/util/collection/KObjectHashMap.template +++ b/common/src/main/templates/io/netty/util/collection/KObjectHashMap.template @@ -236,7 +236,7 @@ public class @K@ObjectHashMap implements @K@ObjectMap { @Override public void remove() { - throw new UnsupportedOperationException(); + iter.remove(); } }; }