As you know it is perfectly valid for an iterator to not implement the
remove() method, the fact of that being a poorly designed API is a separate
issue.

The main reasons for the remove() method not being implemented are:
1. It is very rarely used. Invoking the delete() method on the relationship
object is easy enough anyhow.
2. It adds complexity. In order to support remove() you need to keep track
of the previously returned item to know what to remove, this adds more state
to the iterator and makes the code a bit more complex, which of course means
a higher likelihood of bugs. The cost of this seems a bit high for
supporting a method that is hardly ever used.

Those are the reasons. If you have arguments that counters or invalidates
those reasons please put them forward.

Cheers,
Tobias

On Thu, May 5, 2011 at 5:12 PM, Balazs E. Pataki <pat...@dsd.sztaki.hu>wrote:

> Hi,
>
> Anothor bug like feature I just found. :-)
>
> Node#getRelationships() return an Iterablle, from which I can get an
> Iterator. This Iterator (actually IntArrayIterator) however doesn't
> implement the full Iterator interface as it throws an
> UnsupportedOperationException() when remove() is called on it. (APi
> documentationd doesn't mention this restriction)
>
> Is there any reason why this Iterator cannot implement remove()?
>
> I now have a wrapper around it, where I call delete() on the last
> Relationship returned by next().
>
> Regards,
> ---
> balazs
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <tobias.ivars...@neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to