title: Groovy convert from List to var args for method call
body: <p>I am using a plugin that provides email functionality as follows:</p>
  
  <pre><code>class SendSesMail {
  
      //to
      void to(String ... _to) { 
          this.to?.addAll(_to)
          log.debug "Setting 'to' addresses to ${this.to}"
      }
  
  }
  </code></pre>
  
  <p>The documentation states the class is called as follows:</p>
  
  <pre><code>sesMail {
      from "from@a.com"
      replyTo "reply@a.com"
      to "t@a.com", "t@b.com", "t@c.com"
      subject "Subject"
      html "Body HTML"
  }
  </code></pre>
  
  <p>In the code a <code>List</code> of addresses is built up and I'm trying to figure out how to convert this list to the var args expected by the method.</p>
  
  <p>Converting to a <code>String</code> concatenated with "," doesn't work as this is an invalid email address. I need to be able to separate each List item into a separate parameter to avoid having to iterate over the List and send each email individually.</p>