title: Type safety: Unchecked cast from Object to List<MyObject>
body: <p>I have a ListView listing a custom object (let's say <code>MyObject</code>).</p>
  
  <p>I want to filter it dynamically through an <code>EditText</code> so I had to implement a <code>getFilter()</code> with a publishResults method: </p>
  
  <pre><code>@Override
  protected void publishResults(CharSequence constraint, FilterResults results) {
      MyObjectAdapter.this.setItems((List&lt;MyObject&gt;) results.values);
      MyObjectAdapter.this.notifyDataSetChanged();
  }
  </code></pre>
  
  <p>At this point, Eclipse complains: <code>Type safety: Unchecked cast from Object to List&lt;MyObject&gt;</code></p>
  
  <p>I am sure this cast will always be true, but Eclipse only suggests to add <code>@SuppressWarnings("unchecked")</code> but I'm totally against <code>SuppressWarnings</code> because it's only hiding the problem, not a solution...</p>
  
  <p>I tried adding:</p>
  
  <pre><code>if(results.values instanceof List&lt;MyObject&gt;)
  </code></pre>
  
  <p>But Eclipse complains again, and this solves nothing...</p>
  
  <p><code>Cannot perform instanceof check against parameterized type List&lt;MyObject&gt;. Use the form List&lt;?&gt;</code></p>
  
  <p>I know the casting will always be correct, but which is the proper way to make the code to be sure <code>results.values</code> is actually a <code>List&lt;MyObject&gt;</code> ?</p>
  
  <p>Thanks in advance!</p>