title: How to convert list type in Java hibernate
body: <p>In java application I use hibernate criteria queries, 
  for example:</p>
  
  <pre><code>Criteria criteria = session.createCriteria(Any.class);
  ...
  
  List&lt;?&gt; list = criteria.list();
  </code></pre>
  
  <p>and I definetly know that result list contains only objects of type <strong>Any</strong> but 
  I don't know if it's possible to get list of type defined above?</p>
  
  <p>In this case, if I want to use foreach it's necessary to convert type from object to type <strong>Any</strong></p>
  
  <pre><code>for(Object object : list) {
      ...
      ((Any)object).
      ...
  }
  </code></pre>
  
  <p>Or if I need to get an array I have to do something like this:</p>
  
  <pre><code>list.toArray(new Any[]{});
  </code></pre>
  
  <p>Do you have any ideas?</p>