HomeBlogGet Quote ABQJUGLogin

Syndication

RSSrssAtomatom

Implementing Interfaces In Groovy.

Written by: Dan HinojosaMon, 1 Jan 2007 02:53 PM PST .
Filed Under: Groovyinterfaces
Learning how to implement interfaces in the Groovy programming language has been information that has eluded me since I started learning Groovy 3 weeks ago.  Last week, Greg Barr and Paul King has written up a quick and easy tutorial about how to implement interfaces in Groovy.

Here is an example of implementing an iterator, just to show you how clean and sexy it is:

iter = [ i: 10,
         hasNext: { impl.i > 0 },
         next: { impl.i-- }, ] as Iterator

while ( iter.hasNext() )
       println iter.next()

More information and strategies are available at the link, just to save you from all that typing.  The information was also copied to the Advanced OO section of the User Guide.