0

https://code.google.com/p/google-collections/source/browse/trunk/src/com/google/common/collect/AbstractMultimap.java?r=117

AbstractMultimap is implements Serializable.

In my eyes actual datas are saved to map and totalSize variables.

But both variables are declared with transient keyword.

This fact means that there's no serialization right?

private transient Map<K, Collection<V>> map;
private transient int totalSize; 
Paul Bellora
  • 54,340
  • 18
  • 130
  • 181
thanksnote
  • 1,012
  • 11
  • 9

2 Answers2

2

That's because the AbstractMultimap class doesn't actually contain the backing Map implementation; that's provided by the concrete subclass, which is responsible for managing serialization:

For serialization to work, the subclass must specify explicit
readObject and writeObject methods.
chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152
2

This fact means that there's no serialization right?

No.

It means that those fields are not serialized by the default serialization mechanism. The state is actually being serialized in the writeObject() method ... of a child class.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216