Questions tagged [groovy]
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.
66 questions
2 votes
1 answer
122 views
Find Invalid User Relationships in User to Manager Map (validate map as valid tree structure with no circular relationships)
We have a new service where an admin can upload a spreadsheet of new users they want to add to our application. During our processing we make a union map of all the users both existing and new ...
5 votes
2 answers
192 views
Design - prevent multiple nesting in function
I have a function written in Groovy which needs to save a record and also return response from the server. Function is working fine, but I am not happy with the design because I have a problem with ...
2 votes
1 answer
373 views
Jenkins Declarative pipeline for multi-branch pipleline
I am working on setting up automated build and deploy jobs in jenkins for a php based project. I would like some feedback on my Jenkinsfile. Specifically regarding the parallelization, the (in my ...
5 votes
2 answers
1k views
Groovy script to get average price per group from different data arrays
I've been trying to learn Groovy lately and I tried to solve a problem which involves designing a routine that will calculate the average Product price per Group. I have the following data: ...
1 vote
2 answers
4k views
Replace each element in a list [closed]
Here is how to transform a Zorglub (it is an API that I can not modify): Zorglub transformedZorglub = zorglub.transform() I am given a ...
0 votes
1 answer
117 views
Spring: Creating a Mutable Common Command Object or Controller Interceptor
I'm integrating with a 3rd party vendor that has Users and Organizations in it. My tool is a user administration tool that ...
4 votes
0 answers
240 views
File operations using Groovy
The idea is to read a file - "data" - and write the information to a new file - "output" - only if it meets the criteria (if the resource usage is more than a configured threshold). Content of the ...
2 votes
0 answers
345 views
Groovy Map/Reduce for Jenkins DSL
Jenkins DSL doesn't support collect and inject from what I can tell (I get missing method exceptions when I try), so I ...
1 vote
2 answers
248 views
Is this FizzBuzz code idiomatic Groovy?
I'm new to Groovy but have some experience with Java, C and Python. I'd appreciate your feedback on Groovy style and features in this FizzBuzz code. Review Checklist Is it idiomatic Groovy code? Can ...
1 vote
1 answer
443 views
Extract attachment between MIME boundary markers
I am trying to extract invoice which is surrounded between a boundary keyword in groovy, in the below example boudary key word is a92720f5836d4daaa4251e805cba228b ...
3 votes
1 answer
15k views
Groovy optimize method to convert JSON to map
I have this method which creates a map from a JSON request parameter. Right now I've hard-coded JSON keys to convert it to map. Can it be converted to a generic method which converts a request's JSON ...
1 vote
1 answer
96 views
Finding duplicate invoices
I have a invoiceList which is a List<Map<String:String>> and am trying to find out if all the invoices have same <...
2 votes
2 answers
427 views
Combine lists of objects with no duplicates
I have 2 groovy sql resultset, I need to combine the result set so that project_no should be unique and case_no can have ...
5 votes
1 answer
283 views
More groovifed way of sublist with varying range
Student list of 50 students and a teacher list of 3 teachers. Section XML as the output where each teacher is assigned to a section, and up to 20 students are assigned in that section. Need to loop ...
3 votes
1 answer
134 views
Converting regular text phrase to Pig Latin in Groovy
Am I using the best conventions or are there better ways? ...