Wednesday, July 13, 2005

Collections.sublist() returns a non-serializable list

This gotcha me today. The Collections.sublist() method returns an instance of java.util.RandomAccessSubList, which is obviously not serializable. Solution is easy - just add all contents to an serialziable list implemenation such as ArrayList.

Technorati Tags:

3 comments:

Anonymous said...

Thx, man!

Anonymous said...

Thanks -- your comment saved me after about 90 minutes of fruitless debugging. For Google's sake: this error comes up as a NotSerializableException: java.util.RandomAccessSubList is not serializable.

Anonymous said...

awesome, thanks so much! :)