You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Jochen Theodorou <bl...@gmx.org> on 2015/12/02 00:21:52 UTC
Re: Calling each()/eachWithIndex() on an object that implements both
Iterator and Iterable
Am 28.11.2015 um 01:25 schrieb Felix Dorner:
> Hi,
>
> I'm a new Groovy user. I am trying to use Groovy in the context of EMF
> (www.eclipse.org/emf <http://www.eclipse.org/emf>). This framework
> includes a utility class ContentTreeIterator which implements Iterator
> and Iterable at the same time. Clients are supposed to access instances
> through the Iterator interface. (Using the iterator that's retuned by
> iterator() will yield different results than using the object itself as
> the iterator).
Since a cast won't work in that situation the only thing I can imagine
would be to use an extension method working on ContentTreeIterator or
maybe even better on AbstractTreeIterator, if I have seen right in the
javadoc.
bye Jochen
Re: Calling each()/eachWithIndex() on an object that implements both
Iterator and Iterable
Posted by Felix Dorner <fe...@gmail.com>.
Ok so I'd basically override the provided methods. I thought about the
same, I'll try.
On Wed, Dec 2, 2015 at 12:21 AM, Jochen Theodorou <bl...@gmx.org> wrote:
> Am 28.11.2015 um 01:25 schrieb Felix Dorner:
>
>> Hi,
>>
>> I'm a new Groovy user. I am trying to use Groovy in the context of EMF
>> (www.eclipse.org/emf <http://www.eclipse.org/emf>). This framework
>> includes a utility class ContentTreeIterator which implements Iterator
>> and Iterable at the same time. Clients are supposed to access instances
>> through the Iterator interface. (Using the iterator that's retuned by
>> iterator() will yield different results than using the object itself as
>> the iterator).
>>
>
> Since a cast won't work in that situation the only thing I can imagine
> would be to use an extension method working on ContentTreeIterator or maybe
> even better on AbstractTreeIterator, if I have seen right in the javadoc.
>
> bye Jochen
>
--
Linux. The choice of a GNU generation.