title: If my object is serializable, can I send an ArrayList<> of my object?
body: <p>I am trying to send an <code>ArrayList&lt;MyObject&gt;()</code> over a <code>Socket</code> connection. <code>MyObject implements Serializable</code>, and I am using the <code>ObjectOutputStream</code> &amp; <code>ObjectInputStream</code> at respective ends of the <code>Socket</code> with the corresponding methods on either end. On the one end I send: </p>
  
  <pre><code>output.writeObject(myList);
  </code></pre>
  
  <p>On the other end,</p>
  
  <pre><code>ArrayList&lt;MyObject&gt; myList = (ArrayList&lt;MyObject&gt;) input.readObject();
  </code></pre>
  
  <p>Now my question is if this is valid. I know that <code>MyObject</code> is serializable and there is no problem sending one of them over at a time. However, is this property preserved if I am sending multiple of these objects in some sort of Java collection?</p>