title: Java spread operator
body: <p>I am not sure of the vocabulary I am using here, please correct me if I'm wrong. </p>
  
  <p>In Javascript, I had the following code:</p>
  
  <pre><code>let args = [1,2,3];
  
  function doSomething (a, b, c) {
      return a + b + c;
  }
  
  doSomething(...args);
  </code></pre>
  
  <p>As you can see, when calling <code>doSomething</code>, I am able to use the <code>...</code> spread operator in order to "transform" my arguments into <code>1, 2, 3</code>.</p>
  
  <p>Now, I'm trying to do the same thing with Java. </p>
  
  <p>Let's say I have a <code>Foo</code> class:</p>
  
  <pre><code>public class Foo {
      public int doSomething (int a, int b, int c) {
          return a + b + c;
      }
  }
  </code></pre>
  
  <p>And now I want to call the <code>doSomething</code>:</p>
  
  <pre><code>int[] args = {1, 2, 3};
  </code></pre>
  
  <p>I'd like to use something like <code>doSomething (...args)</code> instead of calling <code>doSomething(args[0], args[1], args[2])</code>.</p>
  
  <p>I saw that this is possible in the declaration of functions, but I'd like not to change the implementation of such a function.</p>