title: problem in generic template in Java
body: <p>can somebody please explain what is wrong with my functions, thanks in advance:
  I have those classes:</p>
  
  <h3>main</h3>
  
  <pre><code> public class Main {
          public static void main(String[] args) {
              String[] inArr = {"Hi", "Great", "Man", "Yeap", "Why"};
              int[] outArr = new int[5];
  
              Summer summing = new Summer();
              outArr = summing.sum(inArr, 2, new sumStringToInt(), outArr); //here problem
  
              for(int i = 0; i &lt; outArr.length; i++){
                  System.out.println(outArr[i] + " ");
              }
  
          }
      }
  </code></pre>
  
  <h3>summer</h3>
  
  <pre><code>public class Summer{
      public &lt;X,Y&gt; Y[] sum(X[] inArr, Y first, SumFunction&lt;Y,X&gt; f, Y[] outArr){
          for(int i = 0; i &lt; inArr.length; i++){
              outArr[i] = f.op(first, inArr[i]);
              first = outArr[i];
          }
          return outArr;
      }
  }
  </code></pre>
  
  <h3>sum function</h3>
  
  <pre><code>public abstract class SumFunction&lt;Y,X&gt; {
  public abstract Y op (Y y, X x);
  }
  </code></pre>
  
  <h3>sumStrinToInt</h3>
  
  <pre><code>public class sumStringToInt  extends SumFunction&lt;Integer, String&gt;{
      public Integer op(Integer num, String s){
          return s.length() + num;
      }
  }
  </code></pre>
  
  <p>I have an error:</p>
  
  <pre><code>The method sum(X[], Y, SumFunction&lt;Y,X&gt;, Y[]) in the type Summer is not applicable for the arguments (String[], int, sumStringToInt, int[])
  </code></pre>