What's the most elgant way in Groovy to specify a range of integers and the 0.5 steps between them? e.g.: 1, 1.5, 2, 2.5, 3, 3.5, 4
Edit: To clarify: As an end result I need a range object for use in a Grails constraint. Though I suppose a list would be OK too.
Best way I can see is using the step command.
i.e.
would print out: "1 1.5 2.0 2.5 3.0 3.5"
Cheat.
Map your desired range into another that is more easily handled by Groovy. You want something like:
which is true if and only if:
which is the same as the range object:
or: