File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Why are Iterators non-serializable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Why are Iterators non-serializable?" Watch "Why are Iterators non-serializable?" New topic

Why are Iterators non-serializable?

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
I am not sure why Iterators in Collections framework are non-serializable? Is it wrong design to have my own iterator which extends serializable interface?

Satya Deep

Thanks and Regards
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
What would it mean to have the Iterator serializable, since you can't force the underlying collection to be serialized at the same time?
I agree. Here's the link:
subject: Why are Iterators non-serializable?
It's not a secret anymore!