I want to serialize an Arraylist containing Date objects and then be able to de-serialize it and iterate over the de-serialized version.
Currently I have a class called DateSerialize that implements Serializable. I have a method for adding date objects into the arraylist and then once that is done i want to serialize it.
Next time when i run the program i want to deserialize that arraylist and get those objects in the same order and format and want to run an iterator over it.
Can anyone help me out with this ??
Thanks !
If you want to use Serializable, you should have no problems, because ArrayList is Serializable just as String and every primitive type.
public class DateSerialize implements Serializable {}should do the rest. You can read more about this method here. However there are a lot of other options for serialization. So please be more specific.EXAMPLE
First: Creating the ArrayList and the object to put in
Second: serializing the ArrayList
Third: deserializing the ArrayList