title: Type safety: Unchecked cast from Object to ArrayList<MyVariable>
body: <p>Here is a part of a program that sends an ArrayList from a server to a client. I want to remove the warning about the last line in this code:</p>
  
  <p>Client code:</p>
  
  <pre><code>Socket s;
  (...)
  // A server is sending a list from the other side of the link.
  ois = new ObjectInputStream(s.getInputStream());
  MyList = (ArrayList&lt;MyVariable&gt;) ois.readObject();
  </code></pre>
  
  <p>MyVariable is a Java class with some attributes. The server is creating an ArrayList and filling it with MyVariable variables as items. Then it sends the complete list to the client.</p>
  
  <p>I would like to know why do I have a warning there and how to code perfectly in order to have 0 warnings. If it is possible I would like to avoid using "@SuppressWarnings("unchecked")". ;)</p>
  
  <p>Thank you,</p>
  
  <p>Luis</p>