Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform.

learn more… | top users | synonyms

1
vote
0answers
43 views

List builder in groovy

I'm a big fan of yield return found in C# and computation expressions found in F#. That is, language features which allow you to build streams of objects which are computed on demand (state-machines ...
0
votes
1answer
33 views

How can use array to imitate repeated individual instances?

I'm working an example to list directory contents. When I process each directory the code works. Now I'd like to put both directories in an array and iterate the array. I get an error when I declare ...
4
votes
1answer
206 views

Constructors and inheritance in Groovy

I am new to Groovy and I am having a little problem with constructors of subclasses. Basically, I have a base abstract class like class BaseClass { def BaseClass(Map options) { // Does ...
1
vote
2answers
151 views

Groovy: permutations() with size limit

I have a problem to solve. My algorithm is assigning Players to Positions. On the start I have a list of about 16 positions and 4 players. The problem is to assing every player to it's closest ...
2
votes
3answers
649 views

Groovy: find all elements in a list equal to the max element

Is there any simpler way to find all elements in a list that are equal to the max element. List v = [ 1,2,3,4,5,5 ] def max = v.max() def maxs = v.findAll { it == max } Thanks!
4
votes
2answers
683 views

Returning Groovy class fields as a map

I want to get a map of all the fields in a class (aka value object) in a generic way. The following works fine for me: class Baz { String foo = "foo2" int bar = 2 public Map asMap() { def ...
6
votes
0answers
309 views

Generating a sequential number for app wide use ( groovy - grails )

I have to generate a sequential number for groovy-grails app wide use and came up with the following. However, is there a better way to do this? DOMAIN CLASSES: class RoastIdCounter { int ...