title: Java 8 Apply a BiFunction to two lists of different objects
body: <p>I need to know how I can apply a <code>BiFunction</code> to two lists of different objects</p>
  
  <pre><code>List&lt;A&gt; listA;
  List&lt;B&gt; listB;
  
  private BiFunction&lt;A,B,C&gt; biFunction=new BiFunction&lt;A,B,C&gt;() {
      @Override
      public C apply(A a, B b) {
          C c=new C();
  
          return c;
      }
  };
  </code></pre>
  
  <p>I need to get a <code>List&lt;C&gt;</code> and for that I have to use <code>biFunction</code> with <code>listA</code> and <code>listB</code>.
  I do not know how to do this in Java 8, the only way I know is this:</p>
  
  <pre><code>List&lt;C&gt; listC=new ArrayList&lt;&gt;();
          for(int i=0;i&lt;listA.size();i++)
              listC.add(biFunction.apply(listA.get(i),listB.get(i)));
  </code></pre>
  
  <p>Obviously <code>listA</code> and <code>listB</code> have the same size.<br>
  It's a horrible solution, please can you suggest a better way?</p>