title: Why am I getting exception java.io.NotSerializableException?
body: <p>I am getting java.io.NotSerializableException: java.util.ArrayList$SubList for the following code.</p>
  
  <pre><code>        ObjectInputStream os=new ObjectInputStream(new FileInputStream("AllEMExampleObjects.dat"));
          Set&lt;EntitiyMentionExample&gt; AllEMs=(Set&lt;EntitiyMentionExample&gt;)(os.readObject());
          EntitiyMentionExample[] AllExamples=AllEMs.toArray(new EntitiyMentionExample[0]);
  
          ObjectOutputStream oo=new ObjectOutputStream(new FileOutputStream("C:\\Users\\15232114\\workspace\\Year2\\FormatedExamples\\TestSerialization.dat"));
          oo.writeObject(AllExamples[0]);
  </code></pre>
  
  <p>Obviously the class EntitiyMentionExample is Serializable that is why a Set&lt;> of it is already stored in dat file (AllEMExampleObjects.dat). Then why is it not Storing a single instance of it now?</p>