0

I am using the version 17.0 of Guava, especially the new collection types. While trying to write an ImmutableTable through a Socket, I realized that the class and its concrete implementations do not seem to be serializable.

However, the two following tickets seem to indicate that the developers are aware of the issue:

Do any of you serialize classes containing ImmutableTable attributes? How could I do this, without resorting to using a Map of Maps?

Axel
  • 811
  • 6
  • 15

1 Answers1

1

Even though ImmuttableTable isn't serializable, you could always use a HashBasedTable or one of the other Table implementations. And then after deserialization, use ImmutableTable.copyOf(deserialized) to get the ImmutableTable again. Not exactly elegant, but simple enough to implement.

Greg Case
  • 3,200
  • 1
  • 19
  • 17
  • That is a very interesting remark. I shall use this instead of `Map>` in my `readObject` and `writeObject` methods. – Axel Apr 30 '14 at 07:28