New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IList.iterator() / listIterator() does not support iterator.remove() #5508

Closed
styjdt opened this Issue Jun 16, 2015 · 1 comment

Comments

Projects
None yet
5 participants
@styjdt

styjdt commented Jun 16, 2015

Whereas IQueue.iterator() returns an iterator which explicitly throws an UnsupportedOperationException on iterator.remove(), in case of IList this operation is simply a NOOP.
One can call iterator.remove(), but it doesn't do anything.
A look in the code (ListProxyImpl) reveals, that the iterator is retrieved from a copy of the list, which explains the situation. Nevertheless here an UnsupportedOperationException would be more clear than simpy to ignore the call silently.
Of course, the "real" remove() functionality would be much better :)

My Hazelcast version: 3.4.2
Example code to reproduce:
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance();
IList list = hazelcastInstance.getList("iterate");
list.add("the entry");
Iterator iterator = list.iterator();
iterator.next();
iterator.remove();
System.out.println("list size should be 0, actual size:" + list.size());
hazelcastInstance.shutdown();

Relevant result on console:
list size should be 0, actual size:1

Since iterator() calls listIterator() and that one calls listIterator(index), the issue is for all iterator-retrieving methods.

@gurbuzali gurbuzali added this to the 3.5.1 milestone Jun 17, 2015

@gurbuzali gurbuzali self-assigned this Jun 26, 2015

@enesakar enesakar modified the milestones: 3.5.1, 3.5.2 Jul 25, 2015

@degerhz degerhz modified the milestones: 3.5.3, 3.5.2 Sep 8, 2015

@jerrinot

This comment has been minimized.

Contributor

jerrinot commented Oct 2, 2015

fixed by #5599

@jerrinot jerrinot closed this Oct 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment