title: Java abstract primitive array addition
body: <p>When primitive arrays given,</p>
  <pre><code>int[] iArr = new int[]{0,1,2,3,4};
  long[] lArr = new int[]{0,1,2,3,4};
  double[] dArr = new int[]{0,1,2,3,4};
  </code></pre>
  <p>And Each provided by Supplier,</p>
  <pre><code>class IarrSupplier {
    int[] supply();
  }
  
  class LarrSupplier {
    long[] supply();
  }
  
  class DarrSupplier {
    double[] supplyer();
  }
  </code></pre>
  <p>How can I add them all in an abstraction way?
  Such as</p>
  <pre><code>interface PSupplier&lt;T&gt; {
    T[] supply();
  }
  
  </code></pre>
  <p>And providers are implements <code>PSupplier&lt;T&gt;</code></p>
  <pre><code>class IarrSupplier implements PSupplier&lt;int&gt; {
    int[] supply();
  }
  
  class LarrSupplier implements PSupplier&lt;long[]&gt; {
    long[] supply();
  }
  
  class DarrSupplier implements PSupplier&lt;double[]&gt; {
    double[] supplyer();
  }
  </code></pre>
  <p>I know primitive type generic is not supported in java.
  And so above will not work at all.</p>
  <p>But If it works, I hope to do,</p>
  <pre><code>// same or several type of PSuppliers will be provided.
  PSupplier[] suppliers = polymorphsSuppliers();
  
  long[] totalSumArray = [my_fixed_length];
  for(PSupplier supplier : suppliers){
    for(int i = 0 ; i &lt; totalSumArray.length ; i++){
      totalSumArray[i] += supplier.supply()[i];
    }
  }
  </code></pre>
  <p>What would possible/better design to do this?</p>
  <p>In short,</p>
  <ul>
  <li>Multiple int[] or long[] (or more summable primitive types data) will be given.</li>
  <li>I want to get grand total all of them.</li>
  <li>I want to make a long[] that accumulate all of each same index value of given arrays.</li>
  </ul>