title: What is the most efficient way to use a wrapper for an object in Java?
body: <p>I am going to use an external search engine in my application. I am defining EngineInterface as follows:</p>
  
  <pre><code>public interface IEngineInterface{
  public abstract List&lt;Result&gt; search(String q);
  }
  </code></pre>
  
  <p>Result class:</p>
  
  <pre><code>public Class Result{
     A a;
     B b;
  }
  </code></pre>
  
  <p>And the Engine class is like this:</p>
  
  <pre><code>public Class Engine implements IEngineInterface{
  private static ExternalEngine e = new ExternalEngine;
  @override
  public List&lt;Result&gt; search(String q) {
     return wrapper(e.search(q));
  }
  </code></pre>
  
  <p>The fact is that e.search doesn't return <code>List&lt;Result&gt;</code> and it returns <code>List&lt;ExternalResult&gt;</code> and I put the wrapper function which goes over each individual list item and convert it. What is the best way for solving this issue? I'm defining my own Result class to have the flexibility to change the ExternalEngine later.</p>