Axel
Axel

Reputation: 811

Serializing Guava's ImmutableTable

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?

Upvotes: 0

Views: 876

Answers (1)

Greg Case
Greg Case

Reputation: 3240

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.

Upvotes: 1

Related Questions