Implementing Interfaces In Groovy.
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:
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.
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()
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.