I had to serialize a complex object, but one of its component was non-serializable ( a third party graph object), so I created a custom serializable version of this Graph class and used Guava List transform to convert the non-serializable object to the custom objects. The serialization writeObject still failed. I will be interested to know why? My assumption is that the Lists.transform performs its operation Lazily (Holding an hidden reference to the orginal object.)
Also is there an workaround for this problem ?
Lists.transform() does perform lazily as you suspected. You could do one of
or, if you want an immutable version,
and then serialize the resulting list.