title: java implement generic interface in an anonymous class
body: <p>Given the following interface, </p>
  
  <pre><code> public interface Callback&lt;T&gt; {
      &lt;K, V&gt; T execute(Operation&lt;K, V&gt; operation) throws SomeException;
   }
  </code></pre>
  
  <p>How would I implement the interface in a new anonymous class where <code>operation</code> is of type <code>Operation&lt;String,String&gt;</code></p>
  
  <p>e.g, this doesn't compile:</p>
  
  <pre><code> Callback&lt;Boolean&gt; callback = new Callback&lt;Boolean&gt;() {
          @Override
          public Boolean execute(Operation&lt;String, String&gt; operation) {
                return true;
          }
   };
   executor.execute(callback);
  </code></pre>