Sure, why not. There may even be a ticket about this in there somewhere...

2011/5/26 Pierre Fouche <[email protected]>

> Thanks Mattias. Do you want me to log a ticket for that ?
>
> --Pierre
>
> On Wed, May 25, 2011 at 1:06 PM, Mattias Persson
> <[email protected]>wrote:
>
> > Hi Pierre,
> >
> > that's a correct observation and I think the reason for it is that it was
> > easier to write it like that and then it was left in that state. I'm
> pretty
> > sure I've never some across anyone, before you, that have had a problem
> > with
> > it. Nonetheless I think it'd be nice to fix it, and at the same time take
> a
> > look at all the iterables in there.
> >
> > 2011/5/25 Pierre Fouche <[email protected]>
> >
> > > Hi,
> > >
> > > This might seem a minor point but...
> > >
> > > The method Node.getRelationships() returns Iterable<Relationships>,
> > > implemented by IntArrayIterator. It turns out that IntArrayIterator
> > > implements both Iterable and Iterator, its iterator() method returning
> > > itself.
> > >
> > > My understanding was that an Iterable was supposed to be stateless,
> > whereas
> > > an Iterator is obviously stateful. Having a stateless Iterable makes it
> > > useable multiple times in a foreach loop, as it returns a new Iterator
> > > whenever iterator() is called. See for instance
> > >
> > >
> >
> http://stackoverflow.com/questions/839178/why-is-javas-iterator-not-an-iterable
> > >
> > > Unfortunately, IntArrayIterator is a stateful Iterable.
> > >
> > > I've noticed that Traverser, which extends Iterable, is implemented by
> > > TraverserImpl, which does not implement Iterator, but returns a new
> > > TraverserIterator whenever iterator() is called. This seems right to
> me.
> > >
> > > I actually ran into this stateless/stateful issue when I refactored a
> > piece
> > > of code that was using the traversal framework and now uses
> > > getRelationships
> > > instead. Some of the tests failed because they were reusing a resulting
> > > Iterable.
> > >
> > > Is the design of IntArrayIterator intentional? Or is it an oversight?
> > >
> > > Thanks,
> > > Pierre
> > > _______________________________________________
> > > Neo4j mailing list
> > > [email protected]
> > > https://lists.neo4j.org/mailman/listinfo/user
> > >
> >
> >
> >
> > --
> > Mattias Persson, [[email protected]]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [[email protected]]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to