I am getting java.io.NotSerializableException: java.util.ArrayList$SubList for the following code.
ObjectInputStream os=new ObjectInputStream(new FileInputStream("AllEMExampleObjects.dat"));
Set<EntitiyMentionExample> AllEMs=(Set<EntitiyMentionExample>)(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]);
Obviously the class EntitiyMentionExample is Serializable that is why a Set<> of it is already stored in dat file (AllEMExampleObjects.dat). Then why is it not Storing a single instance of it now?