Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top