Groovy convert from List to var args for method call
Probably the spread operator, *, is what you’re looking for: def to(String… emails) { emails.each { println “Sending email to: $it”} } def emails = [“t@a.com”, “t@b.com”, “t@c.com”] to(*emails) // Output: // Sending email to: t@a.com // Sending email to: t@b.com // Sending email to: t@c.com Notice that the parentheses on the method call to … Read more